#define stepPin 3
#define stepsPerRevolution 200
unsigned long steps=0;
//for (int i = 0; i < stepsPerRevolution; i++)
// These four lines result in 1 step:
if(steps > 4000UL)
It took 8083 milliseconds. When I uncommented the for loop, it took 8481. I didn't have a stepper hooked up, but that should make no difference. Still a mystery, I wonder if you have an issue with power.
Note that 4000 is divisible by 200 so I think the version with the loop will count to 4200. Counting to 4200 instead of 4000 would make the 'no-loop' time be 8487 (8083 * 4200/4000). Looks like the difference in speed is VERY small.
Given that I don't seem to be crazy regarding the code I started swapping out hardware components. Seems that there was something wrong with the DVR 8825 as it works with both versions of the code after changing it out. Thanks for helping me troubleshoot!
Its very easy to blow such a driver if the connections to the motor aren't rock-solid -
any hint of intermittent connection, or deliberately disconnecting the motor when
the driver is powered up will likely destroy the driver.