Tag

i/o

Browsing

Did you know it is possible to toggle the state of a Arduino OUTPUT pin using a single line of code?  It’s true!  It’s also possible to use digitalRead() on an OUTPUT pin.  Assuming pin 13 was set to output, this single line of code will cause the LED to change state (or flash) each time it is called:


digitalWrite(13, !digitalRead(13));

Keep reading to understand how these two tricks work.