I'm programming the conveyor with Arduino.
The conveyor has a sensor (input 7) at one end of the conveyor.
Every time the sensor is on, I want the stepping motor to transfer the part out of the conveyor with a certain step.
The problem is if there is another part that
drops into the conveyor, I want the program to reset the counter (which is "i" to zero) to let the conveyor transfer the second part out of the conveyor properly.
Would you please help to advise?
Thanks,
Here are the codes.
void setup() {
pinMode(7,INPUT_PULLUP); // sensor
pinMode(9,OUTPUT); // set Pin9 as PUL
pinMode(8,OUTPUT); // set Pin8 as DIR
Serial.begin(9600);
}
void loop() {