const int ledpin = 12; // Pin for the LED, connected to GPIO 12
const int buttonpin = 13; // Pin for the button, connected to GPIO 13
byte buttonstate = 0; // Variable to hold the state of the button (pressed or not)
byte ledstate = 0; // Initialize the LED state as off (0)
void setup() {
// Set the LED pin as an output (we will control this to turn the LED on and off)
pinMode(ledpin, OUTPUT);
// Set the button pin as an input (we will read the button state)
pinMode(buttonpin, INPUT);
Serial.begin(115200);
// Wait for the Serial to connect (only needed on some boards)
while (!Serial) {
delay(10);
}
Serial.println("Powered Up");
}
void loop() {
// TODO: Read the button state
Serial.println("Looping");
// TODO: If the button is pressed (HIGH), toggle the LED state
// TODO: Turn the LED on or off depending on the current ledstate
// TODO: Wait until the button is released to avoid multiple toggles
delay(100);
}