Live breathing leds

adumas77

New Member
Hi.. A while back my son ask me to take some leds and give them some animation. He thought of glowing orbs and wondered if the same could be done with the leds - something where over 1-2 seconds they slowly turn on and glow and then slowly dim out.. Pretty much in sync with the breathing action.

I constructed an LED array of 3 in series and 5 of the series in parallel. The goal is to add a lot more that would be tied to a an external power supply.

I tested various methods using the pwmout command and found it difficult to do a gradual increase. The action is a bit choppy. Also, when the led is at the brightest level, it should have a longer pause, same when it is at the lowest. Overall, the pattern should simulate breathing.

So for those much smarter than me, could anyone look over the code and suggest any code changes I could make... I would be very grateful.

My program is the following...


main:

for b0 = 1 to 20
for b2 = 1 to 50
pwmout 2,1,b0
pause 10
next b2
pause 200
next b0
goto main
 

Michael 2727

Senior Member
The problem is in the values chosen for the PWMOUT.
PWMOUT 2, 1 (= 500,000Hz), b0 ( can only have a range of 1 to 8)
which is Zero to 100% Duty

Program Editor/"TOP TOOL BAR"/PICAXE/Wizards >/pwmout -
is where you will find the PWMOUT Calculator.

Also go to the Code Snippets section of the forum
and look at the LED Fader thread.

PWMOUT 2, 69 =(15,700Hz), b0 (can be 0 to 255) for
0 to 100 % Duty.
 
Top