Pages: [1]   Go Down
Author Topic: Need help on sequencing LEDs  (Read 588 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 513
Posts: 26226
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Eugene, Oregon
Offline Offline
Sr. Member
****
Karma: 9
Posts: 388
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 639
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Pages: [1]   Go Up
Jump to: