how to use an rgb led

by:IPON LED     2020-05-09
With rgb led, you can use all colors in a loop.
Used to make mood lights, emoji bots, or cool light effects.
But simply set the color (Hue)
It can be a bit tricky because you need to convert the brightness values for each red, green, and blue LEDs to separate brightness values.
Wiring the circuit as follows: Red LED anode: D3 Green LED anode: d4 blue LED anode: d4 public cathode-
> 220 ohm resistance-
> GndNOTE: the common cathode resistance provides you with the simplest wiring, and the matching of color to tone value may be a little inaccurate, because the forward voltage drop of the color LEDs is very different.
For more accurate color reproduction, use the 3 220 ohm resistors of the Arduino pin to the anode and connect the cathode directly to the Gnd.
The hue is the value from 0 to 360 (degrees)
It describes the position of the selected color on the color wheel.
Look at pictures and see all kinds of colors (
Source: brightness is controlled separately.
We need some code to convert hue and brightness to RGB level to get into the led.
Note: the maximum value that 8-digit numbers can hold is 255.
Therefore, the hue value is scaled from 0 to 255 instead of from 0 to 360.
/* From Arduino Cookbook, Recipe 7. 4 (Open Source)
Custom message
Chat Online 编辑模式下无法使用
Leave Your Message inputting...