#define BUTTON_PIN 5 // button pin
#define LED_PIN 4 // LED pin (but currently miswired in series with button)
void setup() {
Serial.begin(115200);
Serial.println("Hello, ESP32-S3!");
pinMode(BUTTON_PIN, INPUT_PULLUP);
pinMode(LED_PIN, OUTPUT); // drive LED pin actively
}
void loop() {
int buttonState = digitalRead(BUTTON_PIN);
if (buttonState == LOW) { // button pressed
digitalWrite(LED_PIN, HIGH); // push current out GPIO 3
Serial.println("Button pressed -> LED ON");
} else {
digitalWrite(LED_PIN, LOW); // no current
Serial.println("Button released -> LED OFF");
}
delay(10);
}