Hi, i am prototyping a lid crimper using a conveyor and to move a lasagna tray into position and then 4 pneumatic actuators to seal the lid the process is as such
1 turn on system ( conveyor runs off relay controlled by Arduino)
2 once sensor 1 sees tray stop conveyor and run solenoids then restart conveyor,
problem i have is that the program loops because the tray is still in the path of sensor 1
how do i make it so it does not repeat right away?
We call them status flags.
you set a flag because of some reason, and you watch for the flag.
no need to start a motor that is already running or to stop a belt that is already stopped.
if ( crimpFlag == 1)
run crimper // assume this works perfectly
crimpFlag=0
if (crimpFlag ==0)
run motor // assume this works perfect
if (sensor == high) // tray is in position
stop motor
crimpFlag=1
Just to take that flag example, read about STATE MACHINES - perfect for this type of project.