//Dry/Waste dustbin
/* The idea is to move a platform seated on a servo motor, that would
allow the said waste to fall in one of the dry or waste bins. */
#include <Servo.h>
Servo my_servo;
int i = 0,signal;
long rand_num;
void setup() {
my_servo.attach(3); //Control pin is attatched to 3rd digital output pin
Serial.begin(9600);
randomSeed(analogRead(0));
rand_num = random(100); //Gives a random number substituting the moisture sensor signal
Serial.println(rand_num); //Prints the said number
}
void loop() {
if(rand_num > 50){ //If the signal is below a callibrated threshold the motor would turn 0 deg
my_servo.write(0);
}
else if(rand_num <= 50){ //Opposite
my_servo.write(180);
}
}