LED Random Generator HELP!
![Spragmatic](https://forums.parallax.com/uploads/userpics/667/nGXST42NL48C7.jpg)
Pertaining to my last post.....
· I'm having·problems understanding how to use·the random generator function in the SX/B code.· I've looked through all the forums and the·help index in SX/B and still am not understanding how it actually works.· I'm trying at this point just to get 4 led's to randomly flash on and off.· I would then like to add PWM to the code to get them to fade in and out randomly, but I will take one step at a time.··I'm just not getting it.· Any help would be greatly appreciated.· Thanks!!· ·
· I'm having·problems understanding how to use·the random generator function in the SX/B code.· I've looked through all the forums and the·help index in SX/B and still am not understanding how it actually works.· I'm trying at this point just to get 4 led's to randomly flash on and off.· I would then like to add PWM to the code to get them to fade in and out randomly, but I will take one step at a time.··I'm just not getting it.· Any help would be greatly appreciated.· Thanks!!· ·
Comments
If you explained your requirements in better detail, those of us with a bit more experience could help you out. At the moment your requirements are so vague that anyone wanting to help with code could end up spending a lot of time spinning in circles -- and nobody has time to spin....
The project I'm working on is a set of eyes in a wooden owl that I'm building for my mother in-law for X-Mas. Each eye has (4) individual colored led's to light them up. Yellow, Orange, Green and Red. (I will be wiring the same color led for each eye in series so they come on at the same time) I will have a total of (4) toggle switches in the circuit. (3) to change to each color besides Yellow and (1) to put it in a random flash mode. So this being said, here's how I would like the program to work.
1. Turn circuit to ON and the Yellow led's come on.
2. Switch #1 turns off Yellow, turning on Orange.
3. Switch #2 turns off Yellow, turning on Green.
4. Switch #3 turns off Yellow, turning on Red.
5. Switch #4 turns all led's into a random flash mode with led's fading in and out with PWM.
6. Some way to keep eyes Yellow if (2) or more of the switches are turned on at the same time.
That should do it. I am fairly new to this stuff, but I do understand adding the switches as inputs with pull-up resistors. I also have wrote a couple of simple PWM programs for another project, but I'm not sure on the random generator and adding all these together in one program. Hope this helps! Thanks JonnyMac!!
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·