Hello, Is it possible to override the old values in serial monitor without keep on scrolling trough to see newer ones? This is my old currently I'm just trying to real the analog pins for test.
Joseph
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
Serial.println("");
int sensorValue2 = analogRead(A1);
Serial.println(sensorValue2);
Serial.println("");
int sensorValue3 = analogRead(A2);
Serial.println(sensorValue3);
Serial.println("");
int sensorValue4 = analogRead(A3);
Serial.println(sensorValue4);
Serial.println("");
int sensorValue5 = analogRead(A4);
Serial.println(sensorValue5);
Serial.println("");
int sensorValue6 = analogRead(A5);
Serial.println(sensorValue6);
delay(1000);
}
With an LCD, just set the cursor to the appropriate position, print spaces over the old value, reposition the cursor, then print the new value. Overwriting with spaces is needed to erase any digits of the number that would be left on the LCD if the new number has less digits.
Bearing in mind the time it has taken for the Serial monitor to be moved to its own floating window and to fix the bug that prevents the full text in it to be selected I would not hold your breath
Everyone here makes great points. But in my case i wish I can only see the current value of things and not the past. I know it's great to see where the values have been. But in my cause it's more like to see if things are jamming up and where. It's not a big deal really. I was just wondering.
The for loop I added at the bottom of your code will give the illusion the data is updating on the serial monitor in place. It actually just pushes the previous data off the screen.
I changed the baud rate to 115200 for it to perform smoother.
Untested
void setup() {
Serial.begin(115200);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
Serial.println("");
int sensorValue2 = analogRead(A1);
Serial.println(sensorValue2);
Serial.println("");
int sensorValue3 = analogRead(A2);
Serial.println(sensorValue3);
Serial.println("");
int sensorValue4 = analogRead(A3);
Serial.println(sensorValue4);
Serial.println("");
int sensorValue5 = analogRead(A4);
Serial.println(sensorValue5);
Serial.println("");
int sensorValue6 = analogRead(A5);
Serial.println(sensorValue6);
delay(1000);
for (int i = 1; i < 40; i++) {
Serial.println();
}
}
In theory, one could use that method to emulate a 16x2 or 20x4 LCD in Serial Monitor. Also, if one reduces the height of SM appropriately, one can minimize the number of blank lines needed.
Interesting. Another rabbit hole to avoid this morning.