docs-content
docs-content copied to clipboard
Add delay() in plotter examples
What This PR Changes
This PR adds delay() in the examples of software/ide-v2/tutorials/ide-v2-serial-plotter
The original examples doesn't have delay() in the loop(), which is fine for the boards with hardware serial ports. The baudrate (9600) limits the data speed.
However, for boards with USB serial port, the baudrate doesn't take affect. The board will send data to the PC at the maximum speed.
Contribution Guidelines
- [x] I confirm that I have read the contribution guidelines and comply with them.
@jhansson-ard Hi. Would this PR be accepted?
Hello @wh201906! I've added someone from my team to take a look at your suggestion.
Thank you so much for your contributions! ⭐
@jhansson-ard @jacobhylen Hi. Would this PR get accepted?
I set the delay timeout as 20ms because the original example takes around 32ms to send a frame to the hardware serial.
(9600baud,8N1->960Bytes/s, ~31bytes per frame, (31B)/(960B/s)≈32.292ms)
With the delay(20), the plot speed of the hardware serial won't go too slow, but the speed of USB serial is throttled to the same order of magnitude as the hardware serial's.