jaddion82052:
My next question is how do you mitigate overrunning the loop time?...SNIP
it may have overrun by nearly 50% of the loop time, and thus giving an inaccuracy.
One possibility is that a 16MHz Arduino is not fast enough for what you want.
How often do you want the time critical function to repeat?
Is it essential for all of the other functions to run between each call to the time critical function? Maybe it would be sufficient to call one of those functions in turn between calls to the time-critical function. For example
void loop() {
timeCrtical();
if (count == 0) {
otherFunctionA();
}
else if (count == 1) {
otherFunctionB();
}
// etc
count ++;
if (count > maxCount) {
count = 0;
}
}
OR, maybe the count should only be incremented within the timeCritical() function so that it changes once for every run of the timeCritical() function?
...R