{"id":16619343,"url":"https://github.com/tomwhite/pong","last_synced_at":"2026-04-29T14:03:00.129Z","repository":{"id":66918170,"uuid":"594785598","full_name":"tomwhite/pong","owner":"tomwhite","description":"An Arduino port of pypaddle, which is \"a paddle ball bouncing game very similar to Pong\"","archived":false,"fork":false,"pushed_at":"2023-02-02T14:02:45.000Z","size":4456,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-25T19:03:06.231Z","etag":null,"topics":["arduino","games","maker","retro-computing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomwhite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-29T16:33:14.000Z","updated_at":"2023-01-29T16:38:27.000Z","dependencies_parsed_at":"2023-05-14T00:30:10.217Z","dependency_job_id":null,"html_url":"https://github.com/tomwhite/pong","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomwhite/pong","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomwhite%2Fpong","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomwhite%2Fpong/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomwhite%2Fpong/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomwhite%2Fpong/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomwhite","download_url":"https://codeload.github.com/tomwhite/pong/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomwhite%2Fpong/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32428622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","games","maker","retro-computing"],"created_at":"2024-10-12T02:25:02.875Z","updated_at":"2026-04-29T14:03:00.089Z","avatar_url":"https://github.com/tomwhite.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pong\n\nAn Arduino port of [pypaddle](https://github.com/arpruss/pypaddle), which is \"a paddle ball bouncing game very similar to Pong\".\n\n\u003cimg alt=\"Pong OLED\" src=\"logo.png\" width=\"300\"\u003e\n\nThis version can use an OLED display, or a TV via the TVout library.\n\n## Background\n\nI was inspired to build an Arduino OLED version of Pong after reading [this post by Benjamin Woehrl](https://medium.com/@ruction/arduino-pong-i2c-oled-128x64-bd4185970b50).\n\nAfter I built it, I came across this [project for building paddle game controllers](https://www.instructables.com/USB-Paddle-Game-Controller/). The author, arpruss, wrote a Python (pygame) implementation of Pong that used the controllers he'd made, and which went to great lengths to reproduce the timings and behaviour of the original. His source for these details included an incredibly in-depth [circuit analysis of the original Atari Pong game](http://www.pong-story.com/LAWN_TENNIS.pdf), by Dr. H. Holden. Before I saw this I hadn't realised that Pong was implemented using TTL chips, rather than a microprocessor.\n\nThe code here is a port of the pypaddle pygame implementation to C++ suitable for running on an Arduino. The original pypaddle code is written so that it can scale to different screen sizes, and the timing code is independent of the speed of the update loop, which means that the experience of playing it on a regular machine using pypaddle, or the port on an Arduino with an OLED screen or a TV is virtually indistinguishable.\n\nI also stumbled across this amazing [electronic circuit simulator in Javascript](http://falstad.com/circuit/). I encourage you to have a look at all the examples, but the [Pong simulation](https://www.falstad.com/pong/) is something else. You can even [play a limited form of the game in the browser](https://www.falstad.com/pong/vonly.html)!\n\n## OLED version\n\n### Parts list\n\n- 1x Arduino Uno and power supply\n- 1x Mini breadboard\n- 1x Adafruit Monochrome 1.3\" 128x64 OLED graphic display\n- 2x Rotary potentiometer 10kΩ (e.g. Pimoroni NH00N2CB10K)\n- 2x Knob\n- 1x Push button\n- 1x Buzzer - 5V\n- 2x JST-PH Jumper Assembly (3 Wire)\n- Jumper wires\n- Solid core wire\n- Solder\n- (Optional) 1x Proto shield or Breadboard shield (e.g. Proto-PIC PPBBSFAR3)\n\n### Wiring\n\nHere's the first version I built on a breadboard:\n\n\u003cimg alt=\"Pong OLED on a breadboard\" src=\"images/oled-breadboard.jpg\" width=\"600\"\u003e\n\nThe controllers are just potentiometers soldered to a JST-PH connector to make it easy to detach them from the breadboard or proto shield.\n\nI used the SPI interface to the OLED, this is explained in detail in the [Adafruit documentation](https://learn.adafruit.com/monochrome-oled-breakouts/wiring-128x64-oleds).\n\nHere's the breadboard wiring diagram:\n\n\u003c!-- ![Breadboard wiring diagram for Pong OLED](images/pong-oled_bb.png | width=500) --\u003e\n\u003cimg alt=\"Breadboard wiring diagram for Pong OLED\" src=\"images/pong-oled_bb.png\" width=\"600\"\u003e\n\nI then transferred the circuit to a proto shield. This is much more compact, and makes it easier to play since the controllers are now either side of the screen.\n\n\u003cimg alt=\"Pong OLED on a proto shield\" src=\"images/oled-proto-shield.jpg\" width=\"600\"\u003e\n\n## TVout version\n\nAfter I got the OLED version working, I updated the code so it could work using the TVout library. Since the picture stored in memory is 128x96 pixels (black or white), that's 12,288 bits, or 1,536 bytes. The Arduino Uno only has 2K of SRAM, so that's less than half a kilobyte left for the game itself. To get it to fit I had to use program memory for the digit segment data. (The [Arduino Memory Guide](https://docs.arduino.cc/learn/programming/memory-guide) is well worth a read to understand the different types of memory an Arduino has.)\n\n\u003cimg alt=\"Pong TVout on a breadboard\" src=\"images/tvout-breadboard.jpg\" width=\"600\"\u003e\n\nAmazingly the TVout library just needs a couple of resistors and a connector to hook up to a TV.\n\n### Parts list\n\nThe parts list is not very different from the OLED version. Instead of the OLED graphic display I used a TV with a composite video input, and the following parts.\n\n- 1x Resistor, 470Ω\n- 1x Resistor, 1kΩ\n- 1x RCA/Phono jack socket\n- 1x Composite video cable\n\nFor the RCA socket I de-soldered one from a very old broken Raspberry Pi board I had lying around.\n\n### Wiring\n\nHere's the breadboard wiring diagram:\n\n\u003cimg alt=\"Breadboard wiring diagram for Pong TVout\" src=\"images/pong-tvout_bb.png\" width=\"600\"\u003e\n\n## Code\n\nBoth the OLED and TVout version use the same codebase. You just need to change a `#define` at the top to compile for one or the other.\n\n[pong.ino](pong.ino)\n\nI used version 2.3.1 of the Adafruit SSD1306 library for the OLED display.\n\nThere are several versions and forks of the TVout library. I manually installed the one from https://github.com/nootropicdesign/arduino-tvout, from the people behind the wonderful [Hackvision](https://nootropicdesign.com/hackvision/) (which, BTW, also has an implementation of Pong).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomwhite%2Fpong","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomwhite%2Fpong","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomwhite%2Fpong/lists"}