In this project, we will learn how to build Arduino pong game with UNO and Oled color display screen. The Pong game is the very easiest arcade game. Now you can make it with Arduino; you can play with the computer.
User Also Read:
You can play towards the laptop through controlling the touch button. Every time a participant rankings, the score displayed on the Oled screen. The first player to attain eight points to wins! It’s far a fun mission to build and as you’re going to find out, it won’t take you more than 10 minutes to make it. Let’s start…,
Arduino pong game step by step guide:
For Arduino pong game project we need Arduino UNO or Mega 2560, it is your choice. One color OLED display, A breadboard, Two touch button to play game one for the right side other for the left side.
List of required components:
- Arduino Board (Any) 5$.
- OLED Display 10$.
- Two Buttons.
- 1x beadboard.
- jumper wires.
The cost of this project is around about 17$ max however you can use Arduino Nano board to make it more compatible in size to fit in the box and inexpensive.
Now connect all components together. At first, we will connect display and buttons on the breadboard then connect all the ground to negative rail on the breadboard then connect negative rail to Arduino GND pin with jumper wires.
GND to the Breadboard negative rail.
Vcc to Arduino 3.3V of the Arduino.
SCL to Digital Pin 13 of the Arduino.
SDA to Digital Pin 11 of the Arduino.
Reset to Digital Pin 9 of the Arduino.
DC pin to Digital Pin 8 of the Arduino.
CS pin to Digital Pin 10 of the Arduino.
Now next step is to connect left button to digital pin3 and right button to digital pin2. We made all the connection of components now the final step is to upload the code to Arduino board. Read below for the Source code of this project.
Code for Arduino pong game project:
Now the final step is to upload the code to Arduino board to play pong game. You need two libraries for this project to work code correctly.
Step 1: Download Adafruit GFX library from here.
Step 2: Download Color OLED Library from here
Step 3: when you download the both libraries from the above links now you have to install them on your Arduino IDE. If you don’t know how to install libraries on Arduino IDE tools, No need to worry. Just follow Step 4 and 5.
Step 4: Open Arduino Goto Sketch then select Include Library from the scroll down menu.
Step 5: Select Add.zip Library give the library zip file path which you have download. That’s it.
Step 6: When you successfully installed libraries now you need to upload Main code to Arduino board. You can find the code from here.
Now you have done everything give power to Arduino and enjoy the Most famous PONG GAME on your Arduino 😀
NOTE: If you want the modification to the game like ball speed, score limit, you have to change some values from the below code.
uint8_t ball_x = 64, ball_y = 32;
uint8_t ball_dir_x = 1, ball_dir_y = 1;
boolean gameIsRunning = true;
boolean resetBall = false;
If you like my work must comment below and share with others. For any question OR help drop comment below 🙂