#include LiquidCrystal lcd(12,11,10,9,7,1); int ld1= 2; int ld2 = 3; int ld3 = 4; int ld4 =5; int buzzer = 6; int motor = 8; int l1 = A0; int l2 = A1; int l3 = A2; int l4 = A3; int st = A4; int a,e; int b; int c; int d; int val = 500; void setup() { lcd.begin(16,2); pinMode(ld1, OUTPUT); pinMode(ld2, OUTPUT); pinMode(ld3, OUTPUT); pinMode(ld4, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(motor, OUTPUT); pinMode(l1, INPUT); pinMode(l2, INPUT); pinMode(l3, INPUT); pinMode(l4, INPUT); pinMode(st, INPUT); lcd.setCursor(4,0); lcd.print("Welcome"); delay(1000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Please wait."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait.."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait..."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait...."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait....."); delay(200); lcd.clear(); lcd.setCursor(0,0); lcd.print("Please wait."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait.."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait..."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait...."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait....."); delay(200); lcd.clear(); lcd.setCursor(0,0); lcd.print("Please wait."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait.."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait..."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait...."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait....."); delay(200); lcd.setCursor(0,0); lcd.print("Please wait....."); delay(200); lcd.clear(); lcd.setCursor(3,0); lcd.print("Water level"); lcd.setCursor(4,1); lcd.print("indicator"); delay(2000); lcd.clear(); } void loop() { a = analogRead(l1); b = analogRead(l2); c = analogRead(l3); d = analogRead(l4); e = analogRead(st); if ( a> val && bval) // level 1 { lcd.print("Tank 25% filled"); lcd.setCursor(2,1); lcd.print("Motor is on"); lcd.clear(); digitalWrite(ld1,HIGH); digitalWrite(motor,HIGH); } if ( a>val && b>val && cval) // level 2 { lcd.print("Tank 50% filled"); lcd.setCursor(2,1); lcd.print("Motor is on"); lcd.clear(); digitalWrite(ld1,HIGH); digitalWrite(ld2,HIGH); digitalWrite(motor,HIGH); } if ( a>val && b>val && c>val && dval) // level 3 { lcd.clear(); lcd.print("Tank 75% filled"); lcd.setCursor(2,1); lcd.print("Motor is on"); delay(3000); digitalWrite(ld1,HIGH); digitalWrite(ld2,HIGH); digitalWrite(ld3,HIGH); digitalWrite(motor,HIGH); } if ( a>val && b>val && c>val && d>val ) { lcd.print("Tank 100% filled"); lcd.setCursor(2,1); lcd.print("Motor is off"); lcd.clear(); digitalWrite(motor,LOW); digitalWrite(ld1,HIGH); digitalWrite(ld2,HIGH); digitalWrite(ld3,HIGH); digitalWrite(ld4,HIGH); digitalWrite(buzzer,HIGH); delay(200); digitalWrite(buzzer,LOW); delay(200); digitalWrite(buzzer,HIGH); delay(200); digitalWrite(buzzer,LOW); delay(200); digitalWrite(buzzer,HIGH); delay(200); digitalWrite(buzzer,LOW); delay(200); digitalWrite(buzzer,HIGH); delay(200); digitalWrite(buzzer,LOW); delay(200); digitalWrite(buzzer,HIGH); delay(200); digitalWrite(buzzer,LOW); delay(200); } }