Hardware Reference
In-Depth Information
Figure 2-7
RGB LED attached to pins 9, 10, 11, and ground. The ground leg is
bent back so that it doesn't touch the leg connected to pin 11, which
it crosses. In theory, this LED should have a resistor on each of the
anodes to limit the current going through the LEDs. In practice,
however, I've run this for several hours without the resistor with no
damage to the Arduino or LED. When in doubt, be safe and add a
220-ohm resistor to each anode.
MADE
IN I TALY
DIGITAL (PWM ~ )
- +
L
UNO
AREF
GND
D13
D12
D11/PWM
D10/PWM
D9/PWM
D8
ON
TX
RX
Reset
+3.3V
ARDUINO
+5V
Gnd
Gnd
Vin
RESET
ICSP
POWER
ANALOG IN
Arduino
Module
D7
D6/PWM
D5/PWM
D4
D3/PWM
D2
Digital1/TX
Digital0/RX
Analog0
A1
A2
A3
A4
A5
That's about as simple a protocol as you could imagine.
However, you still need to write a program for the micro-
controller to read the data one byte at a time, and then
decide what to do based on the value of each byte.
The program flow is shown in Figure 2-8.
Check for
serial data
'0' - '9'
'r', 'g', or 'b'
Set
brightness
Read received
byte
Set LED
channel
Figure 2-8
Flowchart for the program.
Fade current LED
channel to current
brightness
Search WWH ::




Custom Search