arduino-course/Week 1/Button/Button.ino

20 lines
289 B
Arduino
Raw Permalink Normal View History

2019-11-08 18:14:47 +01:00
//Button
#define BUTTON 8
#define LED 3
bool botonEncendido = false;
void setup() {
pinMode(LED, OUTPUT);
pinMode(BUTTON, INPUT);
}
void loop() {
botonEncendido = digitalRead(BUTTON);
if(botonEncendido){
digitalWrite(LED, HIGH);
} else {
digitalWrite(LED, LOW);
}
}