void setup()
// put your setup code here, to run once:
/*sketch 1
turn on a LED when the buttons is pressed
turn it off when the button is not pressed (or released)
*/
int pinButton = 4; // the pin where we connect the button
int = LED = 13; // the pin connect the LED
void setup() {
// put your main code here, to run repeatedly:
pinMOde(pinButton, INPUT); // set the button pin as INPUT
pinMode(LED, OUTPUT); // set the LED pin as OUTPUT
}
void loop() {
int stateButton = digitalRead(pinButton); //read the state of the button
if(state Button == 1) { // if is pressed
digitalWrite(LED, HIGH; // write 1 or HIGH to led pin
} else { //if not pressed
digitalWrite(LED, LOW); // write 0 or low to led pin
}
delay(20);
}