stewy
stewy copied to clipboard
Need to test on non-Teensy platform
No idea what might break if compiling for (e.g.) Uno, nano, or M0.
I have all an uno and a nano, I can test on those once I get the setup built.
something that might cause it not work on different platforms would be different amounts of time between servo refreshes because the time to do the other loop calculations will be different on micros with different speeds.
Perhaps something like this could set the loop speed to be constant across platforms?
void loopTimer()
{
//The angle calculations are tuned for a loop time of 4 milliseconds. To make sure every loop is exactly 4 milliseconds a wait loop is created by setting the loop_timer variable to +4000 microseconds every loop.
timingProblem = true;
while(loop_timer > micros()){
timingProblem = false; // if the other code takes too long, we never enter the loop.
}
loop_timer = micros() + 4000; //
digitalWrite(problemLED,timingProblem); // show LED if we exceed the loop time
}`