In this project, we will build a Tic-Tac-Toe game using an Arduino Uno and the keypad.
The game will allow you to play Tic-Tac-Toe, and then the LED corresponding to the winner will light up.
- 1 - Arduino Uno
- 1 - Keypad
- 13 - Wires
- 2 - 220 Ohm resistors
- 2 - LED's
- Processing Software
Step 1: Attach Keypad to the Arduino
Connect the Keypad to the Arduino. We will be using pins 2-9.
- Connect the pins as shown in the image above.
- With the keypad face up, you should connect the far left pin on the keypad to pin 9.
- Then, continue to the right and connect them in order going down the Arduino to pin 2
Step 2: Attach LED's to the Arduino
We will attach 2 LED's to the Arduino to show who the winner is.
1. Place the 2 LED's into the breadboard.
2. Connect a 220Ohm resistor from the Anode of the Blue LED (longer side) to pin 11 of the Arduino
3. Connect a 220Ohm resistor from the Anode of the Red LED (longer side) to pin 11 of the Arduino
4. Connect a wire from the cathode of the Blue LED (shorter side) to the ground rail on the breadboard
5. Connect a wire from the cathode of the Red LED (shorter side) to the ground rail on the breadboard
6. Connect the ground rail to the ground pin on the Arduino
Step 3: Run the Code
Download and run the 2 files provided with this tutorial
You can download Processing at processing.org
1. Run the Tic_Tac_Toe.ino file in the Arduino IDE
2. Run the Tic_Tac_Toe.pde file in Processing
3. Use the keypad to play Tic-Tac-Toe!