/* Application: Enclavamiento Author: Guadalupe Nieves Choque Choque */ #define pinLed 1 #define pinButton 3 bool stateButton; bool stateLed=LOW; void setup() { pinMode(pinLed, OUTPUT); digitalWrite(pinLed, stateLed); pinMode(pinButton, INPUT); stateButton = digitalRead(pinButton); } void loop() { if (digitalRead(pinButton)!=stateButton){ stateButton = digitalRead(pinButton); if (stateButton){ stateLed = !stateLed; digitalWrite(pinLed, stateLed); } else{ } } }