Data Sheet

82 : circuit 4c
NEW COMPONENTS
4XAA BATTERY HOLDER: Included in
your kit is a 4-cell AA battery holder. The
5-inch cable is
terminated with
a standard barrel
jack connector.
The connector
mates with the
barrel jack on
the RedBoard, allowing you to easily make
your project battery powered.
NEW CONCEPTS
BUTTON DEBOUNCE: When working
with momentary buttons, it is usually
necessary to add button debouncing to
your code. This is because the code that
is meant to execute when the button
is pressed may execute faster than
you can press and release the button
(microcontrollers are fast!). The simplest
way to debounce a button is to add a
small delay to the end of your code. This
sketch adds a 500 millisecond delay at
the end of loop() to account for this.
This simple addition will prevent a word
from getting skipped when you press the
button for the game.
For a more complex example of button
debouncing, in the Arduino IDE open File >
Examples > 02.Digital > Debounce.
STRINGS: Strings are used to print words
and even sentences to an LCD or the Serial
Monitor. Strings are actually just an array
of characters with a null character at the
end to let the program know where the end
of the string is.
ARRAY OF STRINGS: In circuit
2A you used an array of characters to
represent musical notes. In this program,
you’ll want to make an array of strings.
Strings use multiple characters to make
words, so you’ll need to use a little trick
to put them in an array. The trick is to use
a pointer. When you declare your array,
you’ll use an asterisk (*) after the char
data type, as follows:
const char* arrayOfStrings =
{“Feynman” “Sagan”, “Tyson”,
“Nye”};
Circuit 4C: “DIY
Who Am I?”
Game
“DIY Who Am I?” is based on the popular
Hedbanz game or HeadsUp! app. It’s a fun
party game in which a player holds an
LCD screen to his/her forehead, and other
players give hints to help the player with
the LCD guess the word on the screen.
YOU
NEED
LCD DISPLAY POTENTIOMETER PUSH BUTTON PIEZO BUZZER 20 JUMPER WIRES
AA BATTERY HOLDER DUAL LOCK TAPE 4 AA BATTERIES SCISSORS
(NOT INCLUDED)