The Ladder Game- Hardware emulated in Python and C


Prerequisites:Basic Raspberry setup step by step
Refreshing the Software of the Raspberry Pi
Hardware:Breadboard and Jumper cables or soldering equipment
12 LEDs of any color and fitting resistors
1 Pushbutton

The ladder game is a good project for getting warm with the Raspberry Pi: the breadboard is quickly assembled, soldering a permanent version makes no trouble and the game is installed and run with ease. Additionally, it’s a funny game in itself, so high reward/stress ratio, yay!The Ladder Game- Hardware emulated in Python and C

Gordon Henderson translated the hardware-based ladder game with a capacitor logic into a C version(see his great article about the ladder game on drogon.net) where only the interface(LED display and pushbutton) remains hardware. Herein, his C version translated into python code is presented.

Breadboard circuit

The wiring looks confusing, but it’s quite simple actually. All LED cathodes are connected to the right minus line of the board, which is connected to pin 6(GND) as counted per board numbering. Connect the LED resistors from top to bottom to the pins 11, 12, 13, 15, 16, 18, 22, 7, 24, 26, 19, 21 and the button to pin 3.

Permanent circuit

Ladder Game installation
Clone the python code from GitHub onto the Raspberry Pi with

cd ~
git clone https://github.com/JoBergs/LadderGame.git

The Ladder Game- Hardware emulated in Python and C schematic

Start the game

cd ~/LadderGame/LadderGame
sudo python ladder.py

For climbing the ladder, the pushbutton has to be pressed as precise as possible between the blinking intervals.

Live action

Change difficulty
I lost, it’s not that easy! To change the difficulty, open ladder.py and find the line

1
rCharge = 2200.0  # ohms

Decreasing the value makes the game more easy.

 

For more detail: The Ladder Game- Hardware emulated in Python and C


© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top