const int buttonPin = 7;
const int redPin = 8;
int buttonState = 0;
bool redledState = 0;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
redledState = !redledState;
digitalWrite(redPin, redledState ? HIGH : LOW);
delay(250);
}
}