#define LED_PIN 2
#define BUTTON_PIN 0
bool ledState = LOW;
bool lastButtonState = LOW;
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
int buttonState = digitalRead(BUTTON_PIN);
if (buttonState == HIGH && lastButtonState == LOW) {
ledState = !ledState;
digitalWrite(LED_PIN, ledState);
delay(200);
}
lastButtonState = buttonState;
}