int Button = 9;
int LED_PIN = 4;
int buttonState = 0;
void setup()
{
pinMode(Button, INPUT);
pinMode(LED_PIN, OUTPUT);
}
void loop()
{
// read the state of the pushbutton value
buttonState = digitalRead(Button);
// check if pushbutton is pressed. if it is, the
// buttonState is HIGH
if (buttonState == HIGH) {
// turn LED on
digitalWrite(LED_PIN, HIGH);
} else {
// turn LED off
digitalWrite(LED_PIN, LOW);
}
delay(10); // Delay a little bit to improve simulation performance
}