This wiki has been archived and made read-only.
For up-to-date information about TkkrLab and it's projects please visit our main website at tkkrlab.nl.

1D-PONG

From

Jump to: navigation, search
Project: 1D Pong
360x360px
Name 1D Pong
Initiator Zeno4ever
Status Finished
Skills {{{Skillz}}}
Summary {{{Summary}}}

Creating 1D Pong

Create a 1D Pong for Gogbot festifal (for the night program)


1D PONG (beta version)


We got the inspiration from :

Build details

Hardware

The 1D-Pong game is based on a Freescale FRDM-KL25Z board, and a pixelstrip based on LPD6803 LED driver. The pixelstrip this was written for had 50 pixels (150 LEDs, each pixel is 3 LEDs in row). To drive the pixels the SPI interface of the KL25Z is used. 2 Buttons are used to control the paddle, they are decoupled with two 100nF capacitors (both for debouncing and to be more immune to interfering EM fields).

To connect your KL25Z:

  • one pushbutton between PTD0 and GND (should be normally closed, so if you hit it it should be zero ohm, if released it should be infinity ohm
  • the other pushbutton between PTD5 and GND (same story as above)
  • Use PTD2 for DATA and PTD1 for CLOCK to the LED strip. I used a simple HCT buffer in between the ledstrip and the mbed to shift between 3V3 and 5V. The LDP6803 has pullups on its inputs, so CLK and DATA are always pulled to 5V. The mbed is working at 3V, so use something to buffer between those two (could be as simple as a FET, I chose to build a buffer out of a quad NAND, just because it was lying around in the space).

Game

The 1D-pong game is a bit like the old 'Pong' game on old consoles. In the normal game you have to place your 'bat' in the right vertical position to hit the ball, but as this is a one-dimensional space there's not much to move in the second dimension. Instead, a 'ball' (in this case a line) moves along the LED strip from one player to the other (each of 2 players placed at one side of ledstrip). You'll have to hit it in time to return it. If you hit too soon or too late, you're losing one 'set'. If you hit the 'ball' within the correct timeframe you'll return the ball to the other side. To make the game more interesting: the later you hit the 'ball', the faster you'll return the ball to your opponent. How much risk are you willing to take?

Features

Animation at end of set

At the end of a set - no one hit the 'ball' in time - you can see who won (green side) or lost (red side) the previous set.

Score Keeping

After each set the string show how much points each contestant has acquired; the last update shows who's winning (green) and who's losing (red)

Logging

At the serial port (PTA2) ASCII messages are sent at 115k2 to tell current score, and whether someone has hit his/her paddle.

Software

The KL25Z board was loaded with mbed firmware, and programmed with help of the online IDE. The code can be found here:[1]