#include Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &Wire, -1); #define BUTTON_PIN 3 bool buttonPressed = false; void setup() { display.begin(0x3C); pinMode(BUTTON_PIN, INPUT_PULLUP); } void loop() { display.clearDisplay(); int buttonState = digitalRead(BUTTON_PIN); // LOW means button is pressed, HIGH means button is not pressed if (buttonState == LOW) { display.fillRect(0, 0, 128, 64, SH110X_WHITE); } /* // Alternate version without the variable: if (digitalRead(BUTTON_PIN) == LOW) { display.fillRect(0, 0, 128, 64, SH110X_WHITE); } */ display.display(); }