MiniLD #58

Theme: “PONG” – hosted by bitslap – March 2015

← Return to Announcement Post

Back to Browse Entries

πng

by leondryaso - Mini LD 58 Entry

Pong written in Java displayed on SSD1306-powered SPI display connected to Raspberry Pi. Who has got that?! The game is controlled by two buttons connected to Pi GPIO (the second player is "AI" if you can call it this way).

It probably has got a lot of bugs, but I've written it in like 4 hours (yea, let's use 4 hours of 10 days).

The code is actually pretty lame (at least the actual game, SSD1306 library is my port of Adafruit's Python library which is not that bad), so if you want to see it, send me a message. But who would want to see it :D

If you would want to run it, you would need
SSD1306 128x64 SPI display connected to Raspberry Pi SPI dev 0.1
Two buttons connected to ground (it uses internal pull-up). You would also need Pi4J library installed. Then you can run

sudo java -cp "/opt/pi4j/lib/pi4j-core.jar:./SSD1306.jar:." eu.ondryaso.ssd1306.examples.Pong

By default, GPIO 0 is used for UP button, GPIO 1 for DOWN button, GPIO 3 for RST pin of display and GPIO 4 for D/C pin of display (USING WIRINGPI NUMBERING). You can change this by passing arguments -

sudo java -cp "/opt/pi4j/lib/pi4j-core.jar:./SSD1306.jar:." eu.ondryaso.ssd1306.examples.Pong "GPIO 0" "GPIO 1" "GPIO 3" "GPIO 4" 1.6 1.4 5 1

The numbers stand for player speed, computer speed, ball X speed and ball Y speed. Enjoy!

Downloads and Links


Comments

freaknarf says ...
Mar 31, 2015 @ 4:24pm

:D AWESOME! is this your display stuff ?

http://www.adafruit.com/products/661 ?

I really need to try those tiny fruits... GG btw !

leondryaso says ...
Apr 1, 2015 @ 5:00pm

It's actually a really cheap 0.96' SPI OLED from eBay, the Adafruit one is enormously expensive :D

You must sign in to comment.


[cache: storing page]