endTime on the Demo Code

Can someone please explain to me what exactly is happening in this section of the demo code? I am under the impression that endTime should[?] make the Rapiro Robot stop doing his motion, but I can't seem to make that work.

if(endTime > millis()) {
remainingTime = (endTime - millis()) / 10;
for( i = 0; i < MAXSN; i++) {
nowAngle[i] = targetAngle[i] - (deltaAngle[i] * remainingTime);
servo[i].write((nowAngle[i] >> SHIFT) + trim[i]);
}
for( i = 0; i < 3; i++) {
nowBright[i] = targetBright[i] - (deltaBright[i] * remainingTime);
analogWrite(eyes[i], nowBright[i] >> SHIFT);
}
} else if(mode == 'M') {
nextFrame();
} else if(mode == 'P') {
if(bufferTime > 0){
nextPose();
} else if(endTime + 500 < millis()){
//digitalWrite(POWER, LOW);
}
}
}

posted by gt_hatch_ii on 2014-06-26 03:54

( Allowed tags: <b> <s> <code> <blockquote> <img> . Automatic URL link.)

Uploaded image is placed to the bottom of the post. To add multiple images, make post once then edit the post.

Read Terms of Service upon submitting. 投稿する前に利用規約をお読みください。