// the setup function runs once when you press reset or power the board
const int ledpurpura = 12;
const int boton = 2;
/*
int
float
char
String
double
*/
void parpadear(int pin){
digitalWrite(pin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(pin, LOW); // turn the LED off by making the voltage LOW
delay(3000); // wait for a second
}
void setup() { //se ejecuta una sola vez
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
pinMode(ledpurpura, OUTPUT);
pinMode(boton, INPUT_PULLUP); //declara un pin como entrada y activa la resistencia pullup interna para ese pin
}
// the loop function runs over and over again forever
void loop() { //ciclo repetitivo o bucle
parpadear(LED_BUILTIN);
if (digitalRead(boton) == LOW){ //POOLLING
while(true){ //bucle infinito
parpadear(ledpurpura);
if (digitalRead(boton) == LOW){
break;
}
}
}
/* for(;;){
} */
}