Simple Flappy Bird style game made with ESP32, Arduino framework, and a 128x64 SSD1306 OLED.
- Shows a start screen
- Starts game when button is pressed
- Bird jumps on button press and falls due to gravity
- Pipes move from right to left with a random gap
- Score increases when the bird passes a pipe
- Game over on collision with pipe or screen edges
- Keeps best score during power-on session
- Uses buzzer for jump and game-over sounds
- Board: ESP32 Dev Module
- Display: SSD1306 128x64 I2C (
0x3C) - Button: GPIO 26 (active-low)
- Buzzer: GPIO 25
- I2C SDA: GPIO 21
- I2C SCL: GPIO 22
src/game.cpp: main game loop (setupandloop), state transitionssrc/bird.cpp: game state, physics, pipe logic, collision, draw screenssrc/button.cpp: button init and edge-detect press handlingsrc/buzzer.cpp: buzzer tone controlinclude/main.h: display size, I2C pins, global display declarationinclude/bird.h: game variables and gameplay function declarationsinclude/button.h: button API and pininclude/buzzer.h: buzzer API and pin
- Build:
platformio run
- Upload:
platformio run --target upload
- Serial monitor (optional):
platformio device monitor -b 115200
- Press button to start
- Press button to jump
- Avoid hitting top/bottom and pipes
- After game over, press button to restart
- Target frame time is 16 ms (about 60 FPS)
- Pipe gap position is randomized each pipe cycle