Go Down

Topic: Need help on sequencing LEDs (Read 1 time) previous topic - next topic


Hi. I am very excited to have found this forum. In a short time, I have learned quite a bit.

My request today is rather unique. For my daughter's school science project, we need to sequence 13 LEDs.

There are three imperatives:

1) The sequence must be random, any one of the 13 LEDs can start the sequence (or several at once)...the ticket here is the more randomization, the better.

2) The sequence must start from all LEDs off, illuminate each LED in once scond steps, holding each LED lit, until the sequence finally allows all of the LEDs to have illuminated.

3) After the sequence is complete (all of the LEDs have illuminated), all LEDs have to blink one time and then go out, which allows a new random sequence to begin

If anybody can give us some programming direction on this, you are going to make an 11 year old VERY HAPPY!!!!!

Thanks so much!   You guys ROCK


Take a look at random function on the References page.
Use to fill an array withthe sequence you want.
Then to light the LEDs from the array is simple, as is turning them all off and on and off for the blink before restarting.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


It sounds like what you want is very similar to shuffling a deck of cards, only this deck of cards only has one suit.


A few notes:

1. You need an LED strip where each LED can be separately and uniquely addressed. Many are available from online sources.
2. You need an Arduino library that support addressing each LED separately. From experience I can assure you that FastSPI works smoothly.

My LED strip is WS2811 based which does support addressing each LED separately.


Using a ws2811 based led-strip is an option that could very well be used, but it also seems overkill to me.
With twenty I/O-pins available on the arduino you can just as well connect a led + current limiting resistor to thirteen of its pins. Two of those twenty pins are used to communicate with the PC which still leaves room to add five buttons If you'd like. Most standard leds are capable of handling 20 mA each, but since the arduino can handle 200mA max it probably is wise to limit each led to 10mA though.

Go Up