So i am trying to stop my stepper motor when my PIR detect motion. But my motor is not stopping.
Here's the program:
int PIR = digitalRead(3);
if (PIR == 1) {
delay (2000);
}
else {
myStepper.step(1);
}
When i tried this but using a push button instead of the PIR, it worked. But with the PIR, it does not.
What value are you reading from the PIR sensor? How is the sensor wired?
PIR reads 1 when there is motion and 0 when there is not.
The sensor has 3 wire, V+, ground and output.
The sensor has 3 wire, V+, ground and output.
Which you have connected where?
PIR reads 1 when there is motion and 0 when there is not.
Does? Or should?
Do you have a pulldown resistor to make certain that it does? Or does it incorporate one?