hi and good day..how can i make this coding function at the looping part?

i have been tried so many time with the several function such as if elseif, for while , do while to make the void loop part to be repeated. but it still not gonna work. i want to make sure the part for the motor switch function . here i attached the coding . when i simulate in the Proteus, the switch for the motor not stop when it is in LOW.

#include <LiquidCrystal.h>
#define in1Pin 3 // done
#define in2Pin 4 // done
#define buzzer A0 // done
#define enablePin 2 // motor
#define yledPin A2 //done
#define rledPin A3 //done
#define gledPin A1 // done
#define toggleswitch 0 //switch utk start/stop /
#define switchsafety 7 //switch utk safety feature install pd cover /
#define lid 5

LiquidCrystal lcd(8,9,10,11,12,13);
long duration;
int distance;

void setup()
{
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(toggleswitch, INPUT); // sebolehnya guna toggle switch utk start/stop
pinMode(switchsafety, INPUT);
pinMode (yledPin,OUTPUT);
pinMode (rledPin,OUTPUT);
pinMode (gledPin,OUTPUT);
pinMode (buzzer,OUTPUT);
pinMode (lid,INPUT);
lcd.begin (16,2);
Serial.begin (9600);
}

void loop()
{
if(digitalRead(lid)==HIGH)
{
if (digitalRead(toggleswitch)==HIGH)
{
digitalWrite(enablePin,HIGH);
digitalWrite(in1Pin,HIGH);
digitalWrite(in2Pin,LOW);
lcd.home();
lcd.print(“SHREDDING”);
digitalWrite(rledPin,HIGH);
digitalWrite(yledPin,LOW);
return;
}
else {
lcd.home();
lcd.print(“MACHINE STANDBY”);
digitalWrite(enablePin,LOW);
digitalWrite(in1Pin,LOW);
digitalWrite(in2Pin,LOW);
digitalWrite(yledPin,HIGH);
digitalWrite(rledPin,LOW);
return;
}
return;
}
else
{
lcd.home();
lcd.print(“LID NOT CLOSED”);
return;

}
}

hai kak zaini :slight_smile: , kena tambah delay kat bawah LOW ngan HIGH kot

i have been tried so many time with the several function such as if elseif, for while , do while to make the void loop part to be repeated. but it still not gonna work.

The loop() function will repeat (hence its name) unless you take some action to stop it.

What happens when you run the program ?
What should happen when you run the program ?

How are the switches wired ?