int buttonState = 0; void setup() { pinMode(0, INPUT); pinMode(1, OUTPUT); } void loop() { // read the state of the pushbutton buttonState = digitalRead(0); // check if pushbutton is pressed. if it is, the // button state is HIGH if (buttonState == HIGH) { digitalWrite(1, LOW); } else { digitalWrite(1, HIGH); } delay(10); // Delay a little bit to improve simulation performance }