E - Dustibin is the future of world, So every developing country is now finding the ways of collecting the garbage according to their category, like plastic garbage , metallic garbage, or biodegardable and not degradable items saparately.
So to have this thing in mind we have develop a science project of moving and auto open close and E- dustbin. Which will move at predefine path and collect the garbage and also automatically opens when user comes in near to that.
Servo myservo;
int arr[9];
int punnu;
void setup()
{
Serial.begin(9600);
myservo.attach(9);
pinMode(8,INPUT);
pinMode(10,INPUT);
pinMode(11,INPUT);
}
int sawan()
{
int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
int sensorValue3 = analogRead(A2);
return sensorValue1+sensorValue2+sensorValue3/6;
}
void loop()
{
int sum=0;
for(int i=0;i<9;i++)
{
arr[i]=sawan();
}
for(int i=0;i<9;i++)
{
sum=sum+arr[i];
sum=sum/9;
punnu=sum;
}
chauhan:
int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
int sensorValue3 = analogRead(A2);
if((sensorValue1>punnu)||(sensorValue2>punnu)||(sensorValue3>punnu))
{
for (int pos = 0; pos <= 180; pos += 1)
{
myservo.write(180);
delay(500);
}
}
else
{
for (int pos = 180; pos >= 0; pos -= 1)
{
myservo.write(pos);
delay(5000);
}
}
goto chauhan;
}
No comments:
Post a Comment