Hardware Reference
In-Depth Information
You'll send a
1
to turn an LED on, and a
0
to turn it off. Wire an LED up to pin
9 of your Arduino as shown in FigureĀ 6-10.
Figure 6-10:
Single LED connected to Arduino on pin 9
As explained in the previous section, when only sending a single character,
the easier thing to do is to do a simple character comparison in an
if
statement.
Each time a character is added to the buffer, it is compared to a
'0'
or a
'1'
, and
the appropriate action is taken. Load up the code in ListingĀ 6-4 and experiment
with sending a
0
or a
1
from the serial terminal.
Search WWH ::
Custom Search