Pages: [1]   Go Down
Author Topic: Programming Question  (Read 302 times)
0 Members and 1 Guest are viewing this topic.
Providence, RI
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino Rox
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 296
Got Karma?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Logged

Pages: [1]   Go Up
Jump to: