8/31/2023 0 Comments Cathode led segment fading out![]() We are going to write code that flashes through a sequence of colors. Notice how the schematic highlights how the current flows from the I/O pins, through the resistors, into the RGB LED, and then down to ground. Here’s the wiring without a breadboard (not recommended but perhaps easier to see the circuit itself):Īnd here’s the wiring with a breadboard (the schematic on the right is the same either way). We could have used any digital I/O pins however, we chose Pins 6, 5, and 3 for red, blue, and green respectively (these pins support PWM and thus, we’ll be able to use the same circuit for our next tutorial on cross-fading colors with RGB LEDs). With a Common Cathode design, the 2nd leg needs to be hooked up to the GND pin and the 1st (red), 3rd (blue), and 4th (green) legs should connect to digital I/O pins ( don’t forget a current limiting resistor for each). We’re going to start with a Common Cathode circuit + code because it’s more intuitive (and similar to our red LED tutorials) before covering the Common Anode version. Notice how the RGB LED type is clearly labeled. Here are two screenshots of supplier websites ( Sparkfun and Adafruit). It’s called diffused because the epoxy casing is scratchy and not perfectly transparentĪ clear Common Cathode RGB LED from Sparkfun. Instead, consult the supplier website, the datasheet, or experiment with the LED yourself (remember, diodes only work in one direction so as long as you include your current limiting resistors, you should be fine!).Ī diffused Common Anode RGB LED from Adafruit. You cannot tell whether you have a Common Anode or Common Cathode RGB LED by visual inspection. How can I tell if I have a Common Anode or Cathode RGB LED? So, you drive each individual color leg with a higher voltage source. Here, all three embedded LEDs share the cathode leg.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |