#include <Servo.h>
#include<LiquidCrystal.h>
int rs=7,en=6,d4=11,d5=10,d6=9,d7=8;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
int SWITCH=5;
int LED=12;
int POT=A0;
Servo myservo;
int pos = 0;
void setup()
{
myservo.attach(13);
lcd.begin(16,2);
pinMode(5,INPUT);
pinMode(A0,INPUT);
pinMode(12, OUTPUT);
pinMode(3, OUTPUT);
lcd.clear();
}
void loop()
{
{
int POT_1=analogRead(POT);
lcd.print(POT_1);
int mapped_value=map(POT,0,1024,0,60);
{
for (pos = 0; pos <= 90; pos += 1)
{
myservo.write(pos);
delay(40);
}
for (pos = 90; pos >= 0; pos -= 1)
{
myservo.write(pos);
delay(15);
}
if(POT_1>0 && POT_1<50)
{
digitalWrite(5, HIGH);
digitalWrite(12, HIGH);
digitalWrite(3, LOW);
lcd.setCursor(1, 0);
lcd.print("DUSTBIN..");
lcd.setCursor(0, 1);
lcd.print("OPENED!!");
delay(1500);
lcd.clear();
}
else(POT_1<50 )
{
digitalWrite(5, HIGH);
digitalWrite(12, LOW);
digitalWrite(3, HIGH);
tone(3,500);
lcd.setCursor(1, 0);
lcd.print("DUSTBIN..");
lcd.setCursor(0, 1);
lcd.print("IS FULL!!");
delay(1500);
lcd.clear();
}
}
}
}