Go Down

Topic: Running Loop once and leaving LED lit until button released (Read 2327 times) previous topic - next topic

midwesta


Grumpy_Mike

Do i need to use a latch function?
What latch function?
If you want the LEDs to stop on for the whole time a button is pressed just hold your code in a while loop.
Code: [Select]

while(digitalRead(pin) == pressed) { } // where the variable pressed is the logic level you get when the button is held down.

Go Up