Go Down

Topic: Programming Question (Read 307 times) previous topic - next topic

oaxacamatt1

Hi All,
I have a programming question, probably simple to some... (but not for me)

I have set up my Arduino with 6 leds (outputs = 3,5,6,9,10,11) for PWM on my breadboard.  That is ok.

What I would like to do is have a program that increases the led intensity like a bell curve moving like a wave front down the line of leds.  I would like to have that wave loop continously.  

In other words, I am trying to set up the led intensities to scroll or loop (i=intensity,  i, i+1, i+2, i+3, i+3, i+2, i+1, i).  I am little baffled on how to have this loop around.

Oaxacamatt1

roypardi

someone else will chime in with a better idea... but I would approach that through an array and use cos() or sin(). With the array, you get the next value for the lead LED of your curve and push it's current value to the next position in the array- doing that in a repeat loop so all the values get shifted

Personman

Check out http:// http://todbot.com/blog/bionicarduino/

There is a sketch for a RGB mood light where it cycles the intensity of each pin of the RGB led in a similar fashion to fade through different colors.  Perhaps you could modify this code to achieve your goal.

That or i have no idea what you are atempting ;D.



Go Up