#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd (0x27,16,2);
#define led1 0
#define led2 1
#define led3 2
#define Pulsador1 3
int encender_apagar=0;
void setup() {
lcd.begin(16,2);
lcd.backlight ();
lcd.clear ();
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(Pulsador1, INPUT);
}
void loop() {
encender_apagar=digitalRead(Pulsador1);
if (encender_apagar==HIGH){
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
lcd.setCursor (0,0);
lcd.print("Luz verde");
lcd.setCursor (0,1);
lcd.print("Encendidada");
delay(30000);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);
lcd.setCursor (0,0);
lcd.print("Luz amarrilla");
lcd.setCursor (0,1);
lcd.print("Encendidada");
delay(5000);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
lcd.setCursor (0,0);
lcd.print("Luz roja ");
lcd.setCursor (0,1);
lcd.print("Encendidada");
delay(25000);
}
}