Page 1 of 1

LED on pwm on arduino

Posted: Tue Nov 10, 2015 11:41 pm
by Bill Felker
Can someone give a example of lighting a LED on digital pin #9 as a pwm. My attempts seem to be coming up short. I have the the LED wire threw a resistor to ground and when I use the LED component macro it lights fine but on the simulation my pwm meter work like it should but in actual circuit not light from the LED. Thanks in advance . Bill

Re: LED on pwm on arduino

Posted: Wed Nov 11, 2015 11:24 am
by Benj
Hi Bill,

Can you attach your program so far so we can see what your trying and hopefully point you in the right direction. Otherwise we are guessing about your type of Arduino etc..

Re: LED on pwm on arduino

Posted: Wed Nov 11, 2015 1:04 pm
by Bill Felker
Sorry I forgot to attach it.

Re: LED on pwm on arduino

Posted: Wed Nov 11, 2015 2:08 pm
by Benj
Hi Bill,

No problems here is a example that should ramp up the LED brightness and then ramp back down.
uno_led_test_pwm.fcfx
(6.09 KiB) Downloaded 466 times

Re: LED on pwm on arduino

Posted: Wed Nov 11, 2015 8:26 pm
by Bill Felker
Thanks for the sketch. I still am not getting the LED to light with pwm .Do I need the LED to be connected threw the resistor to ground or to the 5 v? I can get it to work using the Arduino compiler in "C" but not threw the flowcode software.
Bill :?

Re: LED on pwm on arduino

Posted: Thu Nov 12, 2015 11:29 am
by Benj
Hello,

Sorry the example I gave had the PWM component set to the wrong output pin, it should now be on pin D9 as you stated.
uno_led_test_pwm-1.fcfx
(6.1 KiB) Downloaded 465 times

Re: LED on pwm on arduino

Posted: Thu Nov 12, 2015 11:18 pm
by Bill Felker
Thank you , once again you have come threw and shown me how to do something in Flowcode. It works well. Now all I have to do is figure out how you decide which PWM pin get selected on this and I will be on my way. Thanks again, you guys never cease to answer a question that even I can wrap my head around it. Bill :D

Re: LED on pwm on arduino

Posted: Thu Nov 12, 2015 11:25 pm
by Bill Felker
LOL, now that was easy . I looked at your 1st example and saw in the properties menu where you list each channel of PWM and saw that they have a output pin associated with it and that I kept using PWM1 in my program which would then relate to $PORTD.6 . Lesson learned - thank you once again. :wink: Bill