const int LED = 9; // define the pin associated to LED const int BUTTON = 7; // define the pin associated to BUTTON int state; // define a variable called "state" void setup() { pinMode(LED, OUTPUT); // set LED pin as output pinMode(BUTTON, INPUT); // set BUTTON pin as input } void loop() { state=digitalRead(BUTTON); if (state==1) {digitalWrite(LED, HIGH);} else {digitalWrite(LED, LOW);} }