const int buttonPin = 3; const int LED = 8; int buttonState = 0; void setup() { // put your setup code here, to run once: pinMode(LED, OUTPUT); pinMode(buttonPin, INPUT); } void loop() { // put your main code here, to run repeatedly: buttonState = digitalRead(buttonPin); if (buttonState == LOW) { digitalWrite(LED, HIGH); } else { digitalWrite(LED, LOW); } }