RGB led - cathode vs anode
#1
Posted 30 March 2012 - 05:00 AM
I am having a blast and probably have a better understanding of circuits (or at least am developing it) than I ever did.
I am posting the program as written for a common cathode LED below:
PWM redLed = new PWM(Pins.GPIO_PIN_D9);
PWM greenLed = new PWM(Pins.GPIO_PIN_D6);
PWM blueLed = new PWM(Pins.GPIO_PIN_D5);
//for purple
redLed.SetDutyCycle(60);
greenLed.SetDutyCycle(0);
blueLed.SetDutyCycle(100);
Thread.Sleep(Timeout.Infinite);
Thanks for any assistance.
#2
Posted 30 March 2012 - 07:07 AM
#3
Posted 30 March 2012 - 06:07 PM
#4
Posted 30 March 2012 - 06:30 PM
#5
Posted 06 April 2012 - 03:25 AM
For common anode RGB LED, connect the anode to VCC and R/G/B cathodes to Netduino PWM pins (through the resistors and possibly transistors), PWM will work inversely: 0% duty cycle = on, 100% = off. The LED will be off when there is voltage on both electrodes (anode connected to VCC, PWM output logic high), because current flows only between different potentials. When PWM output is switched to logic low, the LED turns on. The PWM class does not enable you to specify the 'polarity' (it is supported by the microcontroller though, just not exposed via the managed class), so you need to invert the duty cycle.
Thanks so much - another "revelation" in my practical understanding of circuits - if the voltage is the same on both leads (+/-) no current flows - I know it's probably elementary to everyone else but I just never thought of it that way. This is going to be so much fun!
#6
Posted 20 April 2012 - 06:00 AM
#7
Posted 18 July 2012 - 02:46 AM
#8
Posted 12 February 2013 - 02:36 AM
Just wanted to add a "me too" to the list. Thanks for the info, just needed to jumpstart the brain.
#9
Posted 12 February 2013 - 07:39 AM
in the netmf pwm class you can set an invert boolean in the constructor, so you can use it normally, no matter if its anode or cathode.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users