I have 12 LEDs on each digital output. I would like to use button as a switch to light each of led separately once I click on button.
For example. When I click button for the first time - pin 1 == HIGH for 10 seconds and then, when I click button for second time pin 2 gets HIGH for 10 seconds and then 3th click lights pin 3 etc. On each click different pin gets HIGH.
I just can not find anything like this on the internet. I am absolute noob in programming as well.
Switching between pins upon a click of a button is fairly easy. You need a loop that's reading the button state constantly and upon change (with proper debouncing), you change the digital pin that's high. You can use a state counter to figure out which pin is being lit.
Where I have a question is the ten seconds that you want the pin to be high (LED lit). What happens after ten seconds? What if you don't press the button anymore? Does the LED simply turn off? And what happens when you press the button again? Will the sequence start over? Will it simply continue where you left off?
Thank you for your reply.
After 10 seconds LED(pin) turns off to LOW. If you don't press button any more - all LEDs are off. For example, button has been clicked already 3 times and all LEDs are off, if I click button again, pin 4 goes HIGH for 10 seconds and then turns off again. Loop starts again, when pin 13 has been HIGH for 10 seconds.
I hope you understand.