Light_value = value_RED*((float)value/(float)gradation) ĪnalogWrite(ledpin1, y) // increase the voltage in pin 9 from random to 0 voltsĪnalogWrite(ledpin2, x) // increase the voltage in pin 10 from random to 0 voltsĪnalogWrite(ledpin3, w) // increase the voltage in pin 11 from random to 0 voltsĭelay(30) // waits for 30 milli seconds to see the dimming effectĭelay(700) // wait. Light_value = value_BLUE*((float)value/(float)gradation) Light_value = value_GREEN*((float)value/(float)gradation) If you are using the common anode you can find it under 'LED-RGB-CA-THRU.' To download the latest. Value_BLUE = 200 + random(56) // puts a random number between 0 and 255 into value_BLUE Value_RED = 200 + random(56) // puts a random number between 0 and 255 into value_RED Int ledpin3 = 11 // green LED connected to pwm pin 11 via 1K ohm resistor Rather than having 6 leads (a cathode and anode for each LED) it has only 4 one cathode for each colour, and one common anode. Int ledpin2 = 10 // blue LED connected to pwm pin 10 via 1K ohm resistor RGB LED (common anode) A common anode RGB LED is nothing more complicated than three one colour LEDs (one red, one green, and one blue) housed in a single package. ![]() LEDs or Light Emitting Diodes don’t come with any labeling on it to identify Cathode (-ve,GND) or Anode (+ve). Sometime the diode symbol creates confusion too.Identifing a LEDs the cathode and anode of a led is very easy by looking inside. Int ledpin1 = 9 // red LED connected to pwm pin 9 via 1K ohm resistor So for identification, led’s comes with a unique way to identify its terminals as Anode or Cathode. ![]() random tri-color fading LED *common cathode* ![]() Does anyone have any ideas of where I can begin to get this RGB LED to work? Hints and ideas are appreciated at this point since I've been banging my head on a well for a couple of weeks. I have some code that I found online (Update: Original post can be found at the old forum, it was written by Studio Bricolage) however I can't figure out how to transform the code to work with a Common-Anode RGB LED using pull down resistors.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |