void CountFPS () { frames++; // is this correct? if (TimePassed() >= 1000) { fps = (fps + frames) / 2; TimeUpdate(); frames = 0; } }
bool TimedServo::Update(unsigned long currentMillSec) { if (goal==pos) { lastTime = currentMillSec; return false; // we have arrived } if (!TimePassed(currentMillSec)) return false; // not due for an update // ok update if (pos<goal) pos++; else pos--; write(pos); lastTime = currentMillSec; intermediatGoal += step; return true; }