LEDs help

Hi, Im new to programming, and I really need some help with this:
How can I turn on and off 24 LEDs , one by one, no loop, every time I push reset.
Arduino Mega2560
Any help will be great.

In setup():
byte x;
for (x = 2; x <26; x=x+1){
pinMode (x, OUTPUT);
}
for (x = 2; x<26; x=x+1){
digitalWrite (2, HIGH); // pin to anode, cathode to resistor, resistor to Gnd
delay(100);
digitalWrite (2, LOW);
delay(100);
}

sergoh:
Hi, Im new to programming, and I really need some help with this:
How can I turn on and off 24 LEDs , one by one, no loop, every time I push reset.
Arduino Mega2560
Any help will be great.

Ambiguous. Do you mean that the next led in the sequence turns on each time you press reset? In other words, counting the number of times reset is pressed? If so, why? And why the reset button instead of some other button?

:sweat_smile: ,,I was because its just a project ,sorry. What I mean is that when I press "reset" each LED light up, in sequence, one by one with no loops

That’s what I wrote.
If you don’t want the for () sections, write out each pinMode and digitalWrite() one by one.

Thank you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.