My issue is maybe simple but I haven't been able to figure it out. I am using an arduino uno, seeedstudio motor shield v2, and a wheel encoder. The issue is, the example code for this shield looks like this:
void loop()
{
motor.speed(0, 100); // set motor0 to speed 100
delay(1000);
motor.brake(0); // brake
delay(1000);
motor.speed(0, -100); // set motor0 to speed -100
delay(1000);
motor.stop(0); // stop
delay(1000);
}
But delays are blocking and I can seem to count encoder pulses because of this (presumably). I have tried different implementations of millis() but the encoder reads wild numbers in the 10s of thousands/ negative.