const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) { // Se o botão de pressão estiver
//pressionado, e configurado como HIGH
digitalWrite(ledPin, HIGH); // Acednde o LED
}
else {
digitalWrite(ledPin, LOW); // Caso contrário, apaga o LED
}
}