#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// pins
constexpr uint8_t BTN_START = 2;
constexpr uint8_t BTN_DOWN = 3;
constexpr uint8_t BTN_UP = 4;
constexpr uint8_t LED_PIN = 5;
// two displays, same bus (A4/A5)
Adafruit_SSD1306 topDisp (128, 64, &Wire, -1); // address 0x3C
Adafruit_SSD1306 bottomDisp(128, 64, &Wire, -1); // address 0x3D (set in Wokwi pane)
void setup() {
pinMode(BTN_START, INPUT_PULLUP);
pinMode(BTN_UP , INPUT_PULLUP);
pinMode(BTN_DOWN , INPUT_PULLUP);
pinMode(LED_PIN , OUTPUT);
digitalWrite(LED_PIN, LOW);
Wire.begin();
topDisp.begin (SSD1306_SWITCHCAPVCC, 0x3C);
bottomDisp.begin(SSD1306_SWITCHCAPVCC, 0x3D);
bottomDisp.setRotation(2); // upside-down for opposite player
// splash
topDisp.clearDisplay();
topDisp.setTextSize(2); topDisp.setTextColor(SSD1306_WHITE);
topDisp.setCursor(0, 0); topDisp.print(F("Team A")); topDisp.display();
bottomDisp.clearDisplay();
bottomDisp.setTextSize(2); bottomDisp.setTextColor(SSD1306_WHITE);
bottomDisp.setCursor(0, 0); bottomDisp.print(F("Team B")); bottomDisp.display();
}
void loop() {
bool pressed = digitalRead(BTN_START) == LOW;
digitalWrite(LED_PIN, pressed ? HIGH : LOW);
}