#define BUTTON_PIN 28 // GPIO pin where the button is connected void setup() { // Start Serial communication at 9600 baud rate Serial.begin(9600); // Set the button pin as input with internal pull-up resistor pinMode(BUTTON_PIN, INPUT_PULLUP); } void loop() { // Read the button state (LOW means pressed, HIGH means not pressed) if (digitalRead(BUTTON_PIN) == LOW) { // Send 'OFF' signal to Arduino to turn off the onboard LED Serial.println("OFF"); delay(500); // Debounce delay to avoid multiple triggers } }