Introduction: Arduino LED Pong
This project assumes you have a basic knowledge of circuit components and Arduino software/hardware. My Arduino LED Pong was inspired by an LED Pong I saw on a list of Arduino Project. Rather than viewing any other projects, I started from scratch and created my own!
It uses on/off commands for each LED, timing delays for changing LEDs and recognizing pressed buttons, and writes scores to the Serial Monitor.
Step 1: Setup
1 ~200 Ohm resistor
2 ~10 kOhm resistor
Two push buttons
As shown in the picture, even pins 22-40 are for LEDs, pins 42 and 44 for push buttons. The cathodes of all LEDs are connected, ending with a single 200 ohm resistor. 10 kOhm resistors are for push buttons.
Step 2: One Player
One player is set to work with only one of the push buttons.
The game begins once the button is pressed. The LED light will move towards the button until it reaches the closest button. The player has a short amount of time to press the button to gain a point. If the player hits, the LED light will move away then towards the player again, repeating. Each time the player hits, a point is added to their score. If the player misses, the round is over and the score is displayed on the screen, along with the high score.
The high score will erase once the Arduino is reset.
Step 3: Two Player
As soon as a player presses their button, the game begins. The players have a short time to press their button once the LED closest to their button lights up. If the player hits, the LEDs continue towards the opponent. If the player misses, a point is added to the opponent. The game then continues, starting towards the player who just gained a point for fair play.
The scores will remain logged until the Arduino is reset.
Step 4: Code
The attached Arduino file contains the LED Pong program.
Step 5: Potential Extensions of the Project
- Allow the user to choose One /Two Player without changing the code, possibly using the keyboard input on the Serial Monitor
- Use an external screen to choose One/Two Player and display scores rather than the Serial Monitor
- Multiplayer LED pong (3-4 players)
We have a be nice policy.
Please be positive and constructive.