Introduction: CSCI-1200 Project 2: Simon Says
In this lab you will be using pushbuttons, a LCD screen, and LEDs to create a Simon Says game using the Arduino micro controller.
Hardware required for this project:
1. Arduino Uno
2. LCD screen
3. 4 Pushbuttons
5. 4 LEDs
Step 1: Connect 4 LEDs
For this project it is best to use 4 different color LEDs, such as blue, green, red, and yellow.
To connect an LED to the breadboard:
1. Place the LED on the breadboard
2. Connect a jumper wire from the ground rail to the bottom lead (-) of the LED
3. Connect a jumper wire from the a port on the Arduino, the ports used in the diagram are A2-A5, to the breadboard. Place a 220 Ω (ohm) resistor in the same row as the wire and connect it to the top lead (+) of the LED
4. Repeat Steps 1 - 3 to finish connecting the remaining 3 LEDs to the breadboard
Step 2: Connect 4 Pushbuttons
The pushbuttons will be used to play the game, so should be placed in a spot on the breadboard that is easy to access. To make the game easier to understand, the pushbuttons should be placed in front of their corresponding LED.
Steps for connecting a pushbutton:
1. Insert the pushbutton into the breadboard
2. Connect a wire on the top left of the button to the power rail of the breadboard.
3. Connect a 10K Ω (ohm) resistor to the bottom left side of the button and the ground rail of the breadboard
4. The bottom right side of the button will be connected with a wire to a port on the Arduino, ports 2-5 are used for the buttons in the diagram.
5. Repeat Steps 1-4 to finish connecting the remaining 3 pushbuttons.
Step 3: Connect LCD Screen
The LCD screen will be used to display the player's current score during a game, as well as the high score. The LCD is connected to the breadboard with 16 different pins. The LCD requires a potentiometer to work, so place a potentiometer on to the breadboard. The top left pin of the potentiometer is connected to the breadboard's power rail and the bottom left pin is connected to the ground rail.
The LCD pins are connected in the following order:
- Pin 11
- Pin 10
- Pin 9
- Pin 8
- Pin 7
- Pin 6
Step 4: Code for Simon Says
Attached is the 1200_Project2_Simon.ino file which contains all code required to complete this project. The code uses a random number to decide which pattern will be displayed for each round. EEPROM memory is used to store the High Score, which is displayed on the LCD screen.
We have a be nice policy.
Please be positive and constructive.