I have a short code like this:
main() {
while(1) {
printf( "TEST1 " );
for (int pos = SERVO_OPEN_POSITION; pos < SERVO_CLOSED_POSITION; pos += 25) {
Manipulator.SetPosition(pos);
wait_ms(20);
}
for (int pos = SERVO_CLOSED_POSITION; pos > SERVO_OPEN_POSITION; pos -= 25) {
Manipulator.SetPosition(pos);
wait_ms(20);
}
}
}
I have a servo that I'm just spinning inifnietelyin both directions. After each cycle of servo doing its work I printf a message "Test1". So, I'd expect to see "Test1" in terminal (Tera Term) each time a servo starts a new cycle. Instead, I see nothing until about 10 cycles are done. Then on the terminal something like this shows up:
TEST1 TEST1 TEST1 TEST1 TEST1 TEST1 TEST1 TEST1 TEST1 TE
So I get about 10 messages at once (and often last of them is cut (TE)). After that, again, I have to wait about 10 cycles for next batch of "TEST1" messages to appear.
I also tried doing very similar thing, but without a servo - I just removed
Manipulator.SetPosition(pos);
from the program. Result was the same.
Why is that?