Hardware Reference
In-Depth Information
through some colors for a controllable RGB LED nightlight. It's possible to mix
colors with an RGB LED by changing the brightness of each color.
In this scenario, you use a common cathode LED. That means that the LED has
four leads. One of them is a cathode pin that is shared among all three diodes,
while the other three pins connect to the anodes of each diode color. Wire that
LED up to three PWM pins through current-limiting resistors on the Arduino
as shown in the wiring diagram in FigureĀ 2-7.
Current-limiting
resistors
RGB LED
Button
Pulldown
resistor
Figure 2-7: Nightlight wiring diagram
You can configure a debounced button to cycle through a selection of colors
each time you press it. To do this, it is useful to add an additional function to
Search WWH ::




Custom Search