• Reading the status of the pin turns it into an input. You can force it with pinMode(Relay_pin,"output") but honestly I'd just store the current status of the pin in a variable - it's much easier.

    Reading pin state isn't as easy as you'd think - if the pin was shorted then reading the value would always return 0 even though you might have set the output to 1


Avatar for Gordon @Gordon started