I am working on a project that low loop time is fairly critical. This is arduino code for blinking an RGB strip at a rate matching song for a musical so deaf artists can follow the beat. While looking at something I was playing around with timing (trying to get as tight as possible) and how much serial output commands affect speed and found that when I run the test Timing Test, BAUD rate of the default 9600 gave a loop run time of 18,796 microseconds. A BAUD rate of 115200 gave a loop run time of around 1,516 microseconds. A BAUD rate of 4800 gave a loop run time of 37,608 microseconds
On my actual program Visual BPM, I get about the same numbers, but when I set the BAUD rate really low, at least in this simulator the LED blink rate goes really slow. So, here is what I am wondering:
In regards to code run speed (assuming no purposeful delays being added) when using serial to only send data from the Arduino to the computer,
- Does the actual run time of the loop take more time to run when the BAUD rate is low compared to high?
- When calling 'Serial.println("");' does the Arduino pause execution to push data onto the serial bus, or does it get buffered and something else sends it?
- If it does take more time to run at lower BAUD rates, does removing serial related code when not needed make the Arduino run at speeds equivalent to really high BAUD?