You are on page 1of 3

#include <LiquidCrystal.

h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int in1=10;
int in2=9;
int as1 = A5;
int as2 = A4;
int as3 = A3;
int s1Value = 0;
int s2Value = 0;
int s3Value = 0;
int os1 = 0;
int os2 = 0;
int os3 = 0;
void setup()
{
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);

digitalWrite(in1,LOW);
digitalWrite(in2,LOW);

lcd.begin(16, 2);
lcd.print("RAILWAY GATE");
lcd.setCursor(0, 1);
lcd.print("CONTROL SYSTEM");
delay(5000);
lcd.clear();
lcd.print("IET DAVV INDORE");
delay(5000);
lcd.clear();
lcd.print("GUIDED BY");
lcd.setCursor(0, 1);
lcd.print("Dr.Ajay Verma");
delay(5000);
lcd.clear();
lcd.print("SUBMITTED ");
lcd.setCursor(0, 1);
lcd.print("BY");
delay(5000);
lcd.clear();
lcd.print("AKSHAY GUPTA");
lcd.setCursor(0, 1);
lcd.print("DEVESH JAIN");
delay(5000);
lcd.clear();
lcd.print("HARSHNEET BHATIA");
lcd.setCursor(0, 1);
lcd.print("MEGHNA JAIN");

delay(5000);
lcd.clear();
}
void loop()
{
s1Value = analogRead(as1);
s2Value = analogRead(as2);
s3Value = analogRead(as3);
os1 = map(s1Value, 0, 1023, 0, 255);
os2 = map(s2Value, 0, 1023, 0, 255);
os3 = map(s3Value, 0, 1023, 0, 255);
if(os1 > 150)
{
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("OPEN");
lcd.setCursor(0, 1);
lcd.print("BHOPAL JUNCTION");
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("CLOSE");
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
delay(2000);
}
if(os2 > 150)
{
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("YELLOW");
delay(2000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("RED");
delay(2000);
}
if(os3 > 150)
{
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
lcd.clear();
lcd.setCursor(0, 0);

lcd.print("OPEN");
lcd.setCursor(0, 1);
lcd.print("INDORE JUNCTION");
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("CLOSE");
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
delay(2000);
}