K
L
M
you have at least one LED still hooked up to D13.
In the Serial Monitor window, type in a capital
H and click the Send button or press Enter on your
keyboard. The LED should come on and stay on.
Try a capital L and the LED should go off. H and L
correspond to HIGH and LOW, respectively, and
lowercase letters won’t work.
In the code, scroll down to program line 42 and
look for the line that reads:
This is a conditional statement that checks
for the H character. In the Arduino programming
language, as in its ancestors C and C++, == is an
equality operator that evaluates to either true or
false, whereas = is an assignment operator that
sets values.
N
8. BU TTON
Now let’s add an input device: a jumper wire
hooked up to act like a button. Unplug the USB
cable, install one end of a 2"– 3" wire in hole C- 4,
then replug the USB (Figure M).
Compile and upload File → Examples → 1.Basics
→ DigitalReadSerial. Open the Serial Monitor and
set the baud rate to 9600.
You should see a rapidly scrolling list of ones or
zeros or both. Plug the free end of the jumper into
the ground rail and you’ll see only zeros scrolling
past. Move the jumper end to the power rail and
you’ll see only ones.
When the end of the jumper wire is left unconnected, the voltage present on the input pin of the
microcontroller is subject to change by stray ambient electromagnetic radiation. Connecting it to a
stable voltage level puts it in a steady, known state.
Now, add the following program statement anywhere within the setup function:
This statement enables a built-in pull-up resistor
that connects digital pin 2 (D2) to positive power
69 Make: