SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By texhis
#117862
Hello, I am an artist who is trying to use Lilypad (Lilypad mega 328), but have some problems with programming. I would like to make 12 LED lights on and fade-off at different intervals in order to create a soft starlight effect. Could you let me know how to program the lilypad? Thank you SO much!!!
User avatar
By Selenaut
#117888
You are going to want to have some form of probability tester to get random twinkles. For example, if you use random(min, max) and then check to see if the output is a certain number, it will fade a light (If you check the fade example, you should be able to work it out yourself :D). Set the min to 0 and tweak the max to get the right amount of twinkles.

PS, do not forget to check to see how many PWM outputs you have; you may need more than one LilyPad to fade 12 LEDs (unless you hook up two to a pin or something).