Please may I know how to change the name of the Y axis in the Serial plotter?
At present it says Value1. I want to rename the Y axis to say Voltage.
Thank you.
Please may I know how to change the name of the Y axis in the Serial plotter?
At present it says Value1. I want to rename the Y axis to say Voltage.
Thank you.
In your sketch, insert Serial.print ( "Voltage " ); before the Serial.print with the value
ledsyn, thank you. I appreciate your patience with a newbie.
I am sorry, now I am getting two value texts. The blue check mark does not read anything. Also the text "voltage" does not appear.
/*
ReadAnalogVoltage
Center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
modified by yours truly Dr. G
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1050.0);
// print out the value of the potentiometer as an interger only:
float pi = 3.14;
int value = (int)pi;
Serial.print("voltage= ");
Serial.println(voltage,0);
delay(200); // delay in between reads for stability
}
Hi @drg7. Keep in mind that Serial Plotter is a machine, not a human. Your sketch must produce serial output in a specific format in order for it to be correctly recognized by Serial Plotter.
The format is:
<label>:<value>
where <label>
is the text for the variable's label and <value>
is the value of the variable.
So you must change your code to this:
Serial.print("voltage:");
Serial.println(voltage,0);
ptillisch, thank you. It works, beautifully. I so very much appreciate your help. I've been "fighting" this for a while. The last I read was
Serial.println("Voltage" + sensorValue);
and that was completely wrong.
From your corrected sketch
/*
ReadAnalogVoltage
Center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
modified by yours truly, Dr. G
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1050.0);
// print out the value of the potentiometer as an interger only:
float pi = 3.14;
int value = (int)pi;
Serial.print("voltage:");
Serial.println(voltage,0);
delay(200); // delay in between reads for stability
}