The Serial.print(); effected the SERVO sweep speed, why?

Hi,
I am testing a SERVO sweep sketch, which let the SERVO sweep and do some thing.... lot of Serial.print()s.
I changed: Serial.print(9600) to Serial.print(115200), the SERVO sweep fly. sweep speed changed much fast, why? is this normal?
I tested on a simple SERVO sweep code didn't see the same result.
is this a common sense? or I have to arrange my code and post later.
Thanks
Adam

Serial.printing takes time.

Printing at a high baud rate takes less time.

So maybe it is common sense. Maybe common sense isn’t so common. :wink:

a7

2 Likes

Thanks
I didn't see the same result when tested on SERVO example sweep with added serial.print lines.

Well, maybe I am mistaken.

Perhaps if you posted the code where you are observing the slowing effect, some other explanation would turn out to be three truth.

a7

Because this expresses the speed of data transmission
But there is a priority for each component so that there is accuracy in sending data

1 Like

I have no idea what that means, but the reason for the line speed affecting the sweep speed is that as soon as the Serial output buffer fills up, the sketch will start blocking as it prints, waiting for space in the output buffer.

1 Like

Thanks.
is this mean that the Serial.print speed do effect the other device?
I found few posts mentioned the same matters:

https://www.reddit.com/r/arduino/comments/22720y/does_serial_output_affect_speed/

Thank you.

few things:

  1. the Serial.print speed always slow than SERVO sweep, where the data buffer? can I check it?
  2. can I clear this buffer or how?
  3. should the Serial.print evenly for both SERVO ( FLIR/FRIR)? why the print like the picture, bunch of FL... or bunch of FR...?

Thanks

Certainly - Serial.availableForWrite()

1 Like

Great!
Thank you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.