/*
El pulsador de la derecha enciende y apaga un LED
y el de la izquierda hace que otro LED parpadee tres veces
ched to pin 13.
*/
int buttonPin_i = 7; // the number of the pushbutton pin
int buttonPin_d = 8; // the number of the pushbutton pin
int verde = 11;
int amarillo = 12 ; // the number of the LED pin
// variables will change:
int buttonState_i = 0; // variable for reading the pushbutton status
int buttonState_d = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(verde, OUTPUT);
pinMode(amarillo, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin_i, INPUT);
pinMode(buttonPin_d, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState_i = digitalRead(buttonPin_i);
buttonState_d = digitalRead(buttonPin_d);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState_i == HIGH)
{
digitalWrite(verde, HIGH);
}
else {
digitalWrite(verde, LOW);
}
if (buttonState_d == HIGH) {
// parpadea LED amarillo
digitalWrite(amarillo, HIGH);
delay(500);
digitalWrite(amarillo, LOW);
delay(500);
digitalWrite(amarillo, HIGH);
delay(500);
digitalWrite(amarillo, LOW);
delay(500);
digitalWrite(amarillo, HIGH);
delay(500);
digitalWrite(amarillo, LOW);
}