Arduino Project

Pocket Arcade

Course Introduction

In this lesson, you’ll use an OLED display, input controls, and a game manager system with Arduino to create a retro-style arcade game.

Players interact through button inputs to control on-screen actions, while the game manager updates the gameplay at ~60 FPS. The system includes an intro screen, high-score tracking, and smooth frame rendering for an engaging experience.

Note

If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.

1.1 Install Arduino IDE(Important)
1.2 Introduction of Arduino IDE

Required Components

In this project, we need the following components:

SN

COMPONENT INTRODUCTION

QUANTITY

PURCHASE LINK

1

Arduino UNO R4 WIFI

1

2

USB Type-C cable

1

×

3

Breadboard

1

4

Wires

Several

5

Button

4

6

OLED Display Module

1

Wiring

Pocket_Arcade.png__PID:f0812985-146e-4849-aea4-ef706832dbc1

Common Connections:

OLED Display Module
SDA: Connect to A4 on the Arduino.
SCK: Connect to A5 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.

Button
button1: Connect to the breadboard’s negative power bus, and the other end to 2 on the Arduino board.
button2: Connect to the breadboard’s negative power bus, and the other end to 3 on the Arduino board.
button3: Connect to the breadboard’s negative power bus, and the other end to 10 on the Arduino board.
button4: Connect to the breadboard’s negative power bus, and the other end to 11 on the Arduino board.

Writing the Code

Note
You can copy this code into the Arduino IDE.
Use the C code Pocket_Arcade. You can click here Pocket_Arcade.zip to download it.
To install the library, use the Arduino Library Manager and search for config and display and gamemanager and highscore and install it.
Don’t forget to select the board(Arduino UNO R4 WIFI) and the correct port before clicking the Upload button.


// GameSystem.ino - Hack_updt
#include "config.h"
#include "display.h"
#include "input.h"
#include "gamemanager.h"
#include "highscore.h"


void intro(){
  display.clearDisplay();
  display.drawBitmap(0, 0, epd_bitmap_Intro, 128, 64, 1);
  display.display();
}
void setup() {
  Serial.begin(115200);
  initDisplay();
  intro();
  delay(12000);
  initInput();
  initHighscores();
  initGameManager();
}

void loop() {

  updateInput();
  updateGameManager();
  delay(16); // ~60 FPS
}