You are on page 1of 12

#include <SoftwareSerial.

h>

const int csensor=A3;

const int lsensor=A2;

const int ssensor=A1;

float temp1;

float temp2;

float temp3;

float vout;

const int mot1dw = 7;

const int mot1up = A5;

const int mot2dw = 8;

const int mot2up = 9;

const int mot3lf = A4;

const int mot3ri = 13;

const int griop = 10;

const int gricl = 11;


const int LED1 = 2;

const int LED2 = 3;

const int LED3 = 4;

const int LED4 = 5;

void setup()

pinMode(csensor,INPUT); // Configuring pin A1 as input

pinMode(lsensor,INPUT); // Configuring pin A1 as input

pinMode(ssensor,INPUT); // Configuring pin A1 as input

pinMode(mot1dw,OUTPUT);

pinMode(mot1up,OUTPUT);

pinMode(mot2dw,OUTPUT);

pinMode(mot2up,OUTPUT);

pinMode(mot3lf,OUTPUT);

pinMode(mot3ri,OUTPUT);

pinMode(griop,OUTPUT);

pinMode(gricl,OUTPUT);

pinMode(LED1,OUTPUT);

pinMode(LED2,OUTPUT);

pinMode(LED3,OUTPUT);

pinMode(LED4,OUTPUT);

digitalWrite(mot1dw,LOW);

digitalWrite(mot1up,HIGH);
digitalWrite(mot2dw,LOW);

digitalWrite(mot2up,LOW);

digitalWrite(mot3lf,HIGH);

digitalWrite(mot3ri,HIGH);

digitalWrite(griop,LOW);

digitalWrite(gricl,LOW);

Serial.begin(9600);

digitalWrite(LED1,HIGH);

digitalWrite(LED2,HIGH);

digitalWrite(LED3,HIGH);

digitalWrite(LED4,HIGH);

delay(2000);

digitalWrite(LED1,LOW);

digitalWrite(LED2,LOW);

digitalWrite(LED3,LOW);

digitalWrite(LED4,LOW);

delay(2000);

digitalWrite(LED1,HIGH);

digitalWrite(LED2,HIGH);

digitalWrite(LED3,HIGH);
digitalWrite(LED4,HIGH);

void loop()

Serial.println("Hi this is harshal place object");

delay(2000);

vout=analogRead(ssensor);

temp1=(vout/100);

vout=analogRead(lsensor);

temp2=(vout/100);

vout=analogRead(csensor);

temp3=(vout/100);

delay(2000);

Serial.println(temp1);

Serial.println(temp2);

Serial.println(temp3);

if ((temp1 >= 9.6) && (temp2 >= 9.6) && (temp3 >= 9.6))

{
Serial.println("no object");

delay(2000);

else if ((temp1 <= 9.5) && (temp2 <= 9.5) && (temp3 >= 8.4) && (temp3 <= 9.1) )

Serial.println("large white");

delay(2000);

digitalWrite(mot1dw,HIGH);

delay(8500);

digitalWrite(mot1dw,LOW);

delay(200);

digitalWrite(mot2dw,HIGH);

delay(8500);

digitalWrite(mot2dw,LOW);

delay(200);

digitalWrite(gricl,HIGH);

delay(4000);

digitalWrite(gricl,LOW);
digitalWrite(mot1up,LOW);

delay(8500);

digitalWrite(mot1up,HIGH);

delay(200);

digitalWrite(mot2up,HIGH);

delay(8500);

digitalWrite(mot2up,LOW);

delay(200);

digitalWrite(mot3lf,LOW);

delay(1000);

digitalWrite(mot3lf,HIGH);

delay(200);

digitalWrite(griop,HIGH);

delay(4000);

digitalWrite(griop,LOW);

delay(200);

digitalWrite(mot3ri,LOW);

delay(1100);

digitalWrite(mot3ri,HIGH);

delay(200);

}
else if ((temp1 <= 9.6) && (temp2 <= 9.5) && (temp3 >= 9.12) && (temp3 <= 9.4) )

Serial.println("large green");

delay(2000);

digitalWrite(mot1dw,HIGH);

delay(8500);

digitalWrite(mot1dw,LOW);

delay(200);

digitalWrite(mot2dw,HIGH);

delay(8500);

digitalWrite(mot2dw,LOW);

delay(200);

digitalWrite(gricl,HIGH);

delay(4000);

digitalWrite(gricl,LOW);

digitalWrite(mot1up,LOW);

delay(8500);

digitalWrite(mot1up,HIGH);

delay(200);

digitalWrite(mot2up,HIGH);

delay(8500);

digitalWrite(mot2up,LOW);
delay(200);

digitalWrite(mot3ri,LOW);

delay(1000);

digitalWrite(mot3ri,HIGH);

delay(200);

digitalWrite(griop,HIGH);

delay(4000);

digitalWrite(griop,LOW);

delay(200);

digitalWrite(mot3lf,LOW);

delay(1100);

digitalWrite(mot3lf,HIGH);

delay(200);

else if ((temp1 <= 9.5) && (temp2 >= 9.4) && (temp3 >= 8.4) && (temp3 <= 9.0) )

Serial.println("small white");
delay(2000);

digitalWrite(mot1dw,HIGH);

delay(8500);

digitalWrite(mot1dw,LOW);

delay(200);

digitalWrite(mot2dw,HIGH);

delay(8500);

digitalWrite(mot2dw,LOW);

delay(200);

digitalWrite(gricl,HIGH);

delay(4000);

digitalWrite(gricl,LOW);

digitalWrite(mot1up,LOW);

delay(8500);

digitalWrite(mot1up,HIGH);

delay(200);

digitalWrite(mot2up,HIGH);

delay(8500);

digitalWrite(mot2up,LOW);

delay(200);

digitalWrite(mot3lf,LOW);

delay(1400);

digitalWrite(mot3lf,HIGH);
delay(200);

digitalWrite(griop,HIGH);

delay(4000);

digitalWrite(griop,LOW);

delay(200);

digitalWrite(mot3ri,LOW);

delay(1500);

digitalWrite(mot3ri,HIGH);

delay(200);

else if ((temp1 <= 9.5) && (temp2 >= 9.4) && (temp3 >= 9.01) && (temp3 <= 9.4) )

Serial.println("small green ");

delay(2000);

digitalWrite(mot1dw,HIGH);

delay(8500);

digitalWrite(mot1dw,LOW);

delay(200);

digitalWrite(mot2dw,HIGH);
delay(8500);

digitalWrite(mot2dw,LOW);

delay(200);

digitalWrite(gricl,HIGH);

delay(4000);

digitalWrite(gricl,LOW);

digitalWrite(mot1up,LOW);

delay(8500);

digitalWrite(mot1up,HIGH);

delay(200);

digitalWrite(mot2up,HIGH);

delay(8500);

digitalWrite(mot2up,LOW);

delay(200);

digitalWrite(mot3ri,LOW);

delay(1400);

digitalWrite(mot3ri,HIGH);

delay(200);

digitalWrite(griop,HIGH);

delay(4000);

digitalWrite(griop,LOW);

delay(200);
digitalWrite(mot3lf,LOW);

delay(1500);

digitalWrite(mot3lf,HIGH);

delay(200);

else

Serial.println("place object correct");

delay(2000);