As a learning exercise, I've written a sketch that prints voltages at a switch to the serial monitor.
Within the monitor window is a checkbox for time stamping each serial print.
For a sketch with little more than analog read and serial print, no delays, and a 9600 baud rate, the output seems renarkably slow - maybe 3 serial prints per second.
Is the serial print interval governed independently of the length of sketch and baud rate?
For a sketch with little more than analog read and serial print, no delays, and a 9600 baud rate, the output seems renarkably slow - maybe 3 serial prints per second.
Thanks Bob. I think your previous (brief!) reply was actually slightly more informative. ...
My question was intended to be specifically independant of task and was, perhaps, asked the wrong way. (I'm afraid I have a bad habit of asking questions on forums that are interpreted as something someone else wants to answer, rather than what I am trying to ask. I'll try agiain.)
Other than baud rate, delays, length of sketch, (eg) logical operator processing times, etc are there parameters / settings specifically intended to effect the rate serial.print() will write to the serial monitor?
How do we know what could be causing the problem without seeing you code ?
Maybe you are using a library with blocking functions, maybe you are using a blocking loop in the program, maybe you have several nested for loops with time consuming code at their inner level, maybe you are using multiple floating point calculations or a blocking function. Who knows ?
Post your code and we will try it on our PCs to eliminate the possibility of you having a hardware problem.
Whilst I genuinly appreciate what you're saying, and your willingness to spend time and effort helping.. I really don't mean to be contrary, so I'll try again:
If you wanted to limit the rate at which serial.print() text was displayed in the IDE serial monitor, without affecting any other function, is it possible, and if so, how would you do it? E.g. is there something in the IDE that would limit the rate at which a value was printed, irrespective of how quickly it was changing? Or perhaps is there a parameter or expression explicitly intended to be added directly to serial.print() in order to limit the rate a value is printed, irrespective of the rate it changes?
idrisdraig:
If you wanted to limit the rate at which serial.print() text was displayed in the IDE serial monitor, without affecting any other function, is it possible, and if so, how would you do it? E.g. is there something in the IDE that would limit the rate at which a value was printed, irrespective of how quickly it was changing? Or perhaps is there a parameter or expression explicitly intended to be added directly to serial.print() in order to limit the rate a value is printed, irrespective of the rate it changes?
"Whilst I genuinly appreciate what you're saying, and your willingness to spend time and effort helping.. I really don't mean to be contrary, so I'll try again:"
To put your code in a code box, use the </> icon in the far left of the post tool bar and paste your code between the two bracket sets that appear.
To go back and put your code in a code box, in the bottom right of your post, select "more" and click modify. When the modify post opens, high light your code and click the </> in the far left of the post tool bar. This will put you code in code brackets. Then save the changes.
idrisdraig:
If you wanted to limit the rate at which serial.print() text was displayed in the IDE serial monitor, without affecting any other function, is it possible, and if so, how would you do it?
The same way you would do anything at intervals:
void loop()
{
unsigned long currentTime = millis();
static unsigned long lastTimeSerialOutput = 0;
const unsigned long serialOutputInterval = 5000; // Five Seconds
if (currentTime - lastTimeSerialOutput >= serialOutputInterval)
{
lastTimeSerialOutput = currentTime;
Serial.println("This is your every-five-second update.");
}
// Do other stuff here
}
idrisdraig:
E.g. is there something in the IDE that would limit the rate at which a value was printed, irrespective of how quickly it was changing?
No.
idrisdraig:
Or perhaps is there a parameter or expression explicitly intended to be added directly to serial.print() in order to limit the rate a value is printed, irrespective of the rate it changes?
No.
If you want to do output at intervals, do output at intervals.