#include <LiquidCrystal.h>
const int green_pin=8;
const int yellow_pin=9;
const int red_pin=10;
const int green_delay=12000;
const int yellow_delay=3000;
const int red_delay=12000;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void green()
{
for(int time1=12;time1>0;time1--)
{
digitalWrite(green_pin, HIGH);
digitalWrite(yellow_pin, LOW);
digitalWrite(red_pin, LOW);
lcd.print(time1);
delay(1000);
lcd.clear();
}
}
void yellow()
{
for(int time2=3;time2>0;time2--)
{
digitalWrite(green_pin, LOW);
digitalWrite(yellow_pin, HIGH);
digitalWrite(red_pin, LOW);
lcd.print(time2);
delay(1000);
lcd.clear();
}
}
void red()
{
for(int time3=12;time3>0;time3--)
{
digitalWrite(green_pin, LOW);
digitalWrite(yellow_pin, LOW);
digitalWrite(red_pin, HIGH);
lcd.print(time3);
delay(1000);
lcd.clear();
}
}
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(green_pin, OUTPUT);
pinMode(yellow_pin, OUTPUT);
pinMode(red_pin, OUTPUT);
}
void loop()
{
green();
yellow();
red();
}
Comments