I\'m reading data from 9 different sensors for my robot and I need to display them all steadily, in the same window so I can compare the values and see if any of the reading
It's not possible to clear the Serial Monitor window based on incoming serial data.
I can think of a couple of options, the simplest (and cheatiest) is to use println()
with a fixed width string that you've generated that contains your sensor data.
The Arduino IDE's Serial Monitor's Autoscroll
checkbox means if you persistently send the fixed width string (with 500ms delay perhaps) this will give the impression that it's updating once it gets to the bottom and starts scrolling. You could also shrink the height of the window to make it look like it only has one line.
To accomplish a fixed width string that's suitable for serial println()
you'll need functions to convert your sensor values to strings, as well as pad/trim them to a persistent size. Then concatenate the values together (including separators if it makes the data easier to read)
An output of something similar to this is what i'm hinting at:
| 1.0 | 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8 |
All things considered, this isn't a great solution but it would get you a result.
A far smarter idea is to build another program outside of Arduino and it's IDE that listens to the com port for sensor values sent from the Arduino. Your Arduino program will need to send a message your external program can unambiguously interpret, something like 1=0.5;
where 1 = sensor ID and 0.5 = sensor value. The external program would then keep these values (1 for each sensor). The external program can then display this information in whatever way you'd like, a nice console output would be relatively easy to achieve :-)
C#
has .NET
's serialport
class which is a pleasure to use. (most of the time!)
Python has a module called pyserial
, which is also easy great.
Either language will give you much greater control over console output, should you choose to proceed this way.