You are on page 1of 4

#include<LiquidCrystal.

h>

LiquidCrystal lcd(27,26, 22,23, 24, 25);

//L293D for pin 37, 38

const int motorPin1 = 37;

const int motorPin2 = 38;

int convmotor=28;

int IRsensor=29;

int IRsensor1=30;// sensors 30,31 are dummy sensors for simulating the logic set from the ML model

int IRsensor2=31;// sensors 30,31, are being used to mimic a decision that will be done by the machine
learning choices... Setting any at some logic will give a decision..

int hasobstacle=HIGH;

int hasobstacle1=HIGH;

int hasobstacle2=HIGH;

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(IRsensor1,INPUT);

pinMode(IRsensor2,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("Vegeatable cutter");

lcd.setCursor(1,2);

lcd.print("Ben Mos Pac");

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("Choose for IR 30,31");

hasobstacle1= digitalRead(IRsensor1);// we are reading for the irsensor1

if (hasobstacle1== LOW)// This is for product 1

{
digitalWrite(motorPin1,HIGH);

delay(3000);

digitalWrite(slap1,HIGH);// Here we are knocking off the veg to cutter 1

delay(500); //assume that this is time enough to set an impact knock on the veg

digitalWrite(slap1,LOW);

delay(100);//

digitalWrite(gong,HIGH);// Setting the gong cutter on to cut the veg

delay(2000);// Assume that this is the time for two stroke

else (hasobstacle1==HIGH);// This is for product 2

digitalWrite(motorPin1,HIGH);

delay(43000);

digitalWrite(slap2,HIGH);// Here we are knocking off the veg to cutter 2

delay(500);// assume that this is time enough to set an impact knock on the veg

digitalWrite(slap1,LOW);

delay(100);//

digitalWrite(gong,HIGH);

delay(2000); // Assume that this is the time for two strokes

if (hasobstacle2== LOW)/// this is only going to simulate the error idea

digitalWrite(LED,HIGH);

delay(3000);

lcd.clear();
lcd.print("Unknown product");

digitalWrite(motorPin2,HIGH);// conveyor set to reverse

delay(2000);

else

delay(100);

// lcd.print("ML RECOGNIZING");// We are mimi..ing this nby using irsensors

else

digitalWrite(motorPin1,LOW);

lcd.clear();

lcd.print("CONVEYOR OFF");

delay(5000);

You might also like