Ping-pong with Raspberry Pi B+/A+/Pi 2 model B
Ping-pong with Raspberry Pi B+/A+/Pi 2 model B Random first player. The "jump" between the LEDs is random. When a player wins, he starts the next service. First player to reach 9 wins the game.
This is a ping-pong look-alike but the maximum score is 9 instead of 11 due to
the use of only one 7 segment display per player.
To run it just copy this file to your home directory (usually /home/pi) and
execute the following command in the Raspberry command line
sudo python ~/ping-pongv1.py
A point is won when the other player is unable to press the button on time to
send the “ball” (lit LED) to the other side or if the other player presses the
button in advance.
The player who wins the point starts the next service.
A game is won after 9 points.
A match should consist of any odd number of games (usually five or seven).
For the first service, the starting player is randomly selected.
The time between LED jumps is random to make it more difficult to predict.
The buzzer will sound every time a point is won.
1x Raspberry Pi B+/A+/Pi 2 model B with a microSD card and a USB charger
1x Buzzer (I used a 8-15V 85dB magnetic)
2x 7-segment 13mm red common cathode display
2x 4 pins 3.5mm push-button
6x Red 5mm LED
1x 220 Ohms resistor for the buzzer
9x 1k Ohms resistor for the LEDs, push-buttons and displays
1x Breadboard (a.k.a. Protoboard)
Several coloured single-core cables (male-female and male-male)