Mutuacode
Mutuacode
h>
int convmotor=28;
int IRsensor=29;
int Logicstatep1 = 30;// sensors 30 is a dummy sensors for simulating signal sent from the ML model i.e
Product1 or Product2
int Logicstatee2 = 31;// sensors 31 is a dummy sensors used to mimic an error signal sent by the
ML,Setting logic state HIGH for an error.
int slap1=33;
int slap2=34;
int gong=35;
int LED=36;
void setup()
lcd.begin(16,2);
pinMode(convmotor,OUTPUT);
pinMode(IRsensor,INPUT);
pinMode(Logicstatep1,INPUT);
pinMode(Logicstatee2,INPUT);
pinMode(slap1,OUTPUT);
pinMode(slap2,OUTPUT);
pinMode(gong,OUTPUT);
pinMode(LED,OUTPUT);
pinMode(motorPin1,OUTPUT);
pinMode(motorPin2,OUTPUT);
void loop()
lcd.setCursor(0,0);
lcd.print("VEGETABLE CUTTER");
lcd.setCursor(1,2);
hasobstacle = digitalRead(IRsensor);
if (hasobstacle == LOW)
digitalWrite(motorPin1,HIGH);
lcd.clear();
lcd.print("CONVEYOR ON");
delay(2000);
digitalWrite(motorPin1,LOW);
lcd.clear();
lcd.print("CONVEYOR OFF");
lcd.setCursor(1,2);
lcd.print("LOGIC STATE");
digitalWrite(motorPin1,HIGH);
lcd.clear();
lcd.print("CONVEYOR ON");
delay(3000);
delay(500); //assume that this is time enough to set an impact knock on the veg
digitalWrite(slap1,LOW);
delay(100);//
lcd.setCursor(1,2);
lcd.print("CTIN PRDCT1");
digitalWrite(motorPin1,HIGH);
delay(4300);
lcd.clear();
lcd.print("CONVEYOR ON");
delay(500);// assume that this is time enough to set an impact knock on the veg
digitalWrite(slap1,LOW);
delay(100);
digitalWrite(gong,HIGH);
lcd.setCursor(1,2);
lcd.print("CTIN PRDCT2");
digitalWrite(LED,HIGH);
delay(3000);
lcd.clear();
lcd.print("UNKNOWN PRODUCT");
delay(2000);
else
delay(100);
else
digitalWrite(motorPin1,LOW);
lcd.clear();
lcd.print("CONVEYOR OFF");
}
delay(5000);