MiniLD #58

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

← Return to Announcement Post

Back to Browse Entries

OLED Pong

by anachrocomputer - Mini LD 58 Entry

Another game for the Arduino! This one uses the widely-available SSD1306 OLED display, which gives us 128x64 pixels in a nice blue colour (also avalable with white). I used a raw SSD1306 module, so I needed a CD4050 level-shifter between Arduino (5V) and OLED (3.3V). Other OLED modules have this built-in.

I connected an analog joystick salvaged from a dud PlayStation controller to analog pin 0 for the player control (left bat). The press-switch on the joystick acts as the coin acceptor switch. I wrote a simple AI to control the right-hand bat. The tricky part was making the AI good enough to be interesting without making it so good that you can't beat it!

The Arduino has 2k of RAM, half of which is used for the 128x64 pixel frame buffer. All drawing functions write into this buffer, and then a function 'updscreen()' transfers the buffer to the OLED over an SPI interface. I've used a similar architecture with mobile-phone-type LCD screens. The processor in the Arduino runs at 16MHz, but is still amply fast enough for this kind of game.

Downloads and Links


Comments

Mar 29, 2015 @ 8:19pm

This is ten kinds of awsome :)

qristofer says ...
Apr 1, 2015 @ 7:48pm

Oh wow, that looks awesome.
I want to do more hardware myself. :I

Apr 5, 2015 @ 2:48pm

Glad you like it! I've shot a two-minute video of the game in operation, on YouTube here: https://www.youtube.com/watch?v=ORZMssJ-CQk

You must sign in to comment.


[cache: storing page]