Data Sheet
49 : circuit 2c
PROGRAM OVERVIEW
Check if a new game is starting. If it is, play the start sequence. Reset the counter that keeps track of
rounds, and randomly generate a sequence of numbers from 0 to 3 that controls which LEDs the user will
have to remember.
The game works in rounds that progress from 0 to 10. Each round the game will flash LEDs in a pattern,
and then the player has to recreate the pattern by pressing the button(s) that match the LED(s). In the first
round, one LED will flash, and the player will have to press one button. In the eighth round, eight LEDs will
flash, and the player will have to press eight buttons.
A loop is used to flash LEDs from the sequence until you have flashed the number of LEDs that matches the
round number (1 for round 1, 2 for round 2, etc.).
WHAT YOU
SHOULD SEE
The circuit will flash all of the LEDs
and play a melody. After a few
seconds, it will flash the first light
in the pattern. If you repeat the
pattern correctly by pressing the
corresponding colored button, then
the game will move to the next round
and add another color to the pattern
sequence. If you make a mistake, the
loss melody will play. If you get to
round 10, the win melody will play.
Press any button to start a new game.
Open the Arduino IDE
Connect the RedBoard to a USB port on your computer.
Open the Sketch:
File > Examples > SIK_Guide_Code-V_4 > SIK_CIRCUIT_C-SIMON SAYS
Select UPLOAD to program the sketch on the RedBoard.
SIK v4 Book Oct 13.indb 49 10/18/17 10:00 AM