int buttonPin = 2;
int ledPin = 6;
bool buttonState = false;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH){
digitalWrite(ledPin, LOW);
} else {
digitalWrite(ledPin, HIGH);
}
}