• When I said about pin.read not being reliable, it's really because it depends what you actually connect the pin to.

    For one of those relay modules with the drive electronics, something like:

    pinMode(pin,"output");
    pin.write(!pin.read());
    

    Will probably work fine. I still wouldn't recommend it though :)

About

Avatar for Gordon @Gordon started