예제 #1
0
void CountFPS ()
{
	frames++;

	// is this correct?
	if (TimePassed() >= 1000)
	{
		fps = (fps + frames) / 2; 
		TimeUpdate();
		frames = 0;
	}
}
예제 #2
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;
}