Serial Plotter Stabe Y axis

I have been using the serial plotter with the code for the polygraph machine and I've noticecd that when it is graphing the units on the y axis keep rearranging themselves and I want to get rid of that so the y axis is stable but I don't know how. I think there is a way, if you could help me that would be great

This is the code

void setup()
{
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(3, HIGH);
delay(500);
digitalWrite(4, HIGH);
delay(500);
}

void loop()
{
if (analogRead(A0) > 55)
{
digitalWrite(4, HIGH);
}
else
{
digitalWrite(4, LOW);
}
if (analogRead(A0) > 10)
{
digitalWrite(2, HIGH);
}
else
{
digitalWrite(2, LOW);
}
if (analogRead(A0) > 35)
{
digitalWrite(3, HIGH);
}
else
{
digitalWrite(3, LOW);
}

Serial.println(analogRead(A0));
delay(10);
}

To get control over what the Serial Plotter shows you will probably have to write your own Serial Plotter program on the PC.

What you could do is send 3 values to the Serial plotter, the actual value, one min and one max value, than it will keep the same scaling. (It's only showing two extra values).

void setup() {
  // initialize the serial communication:
  Serial.begin(9600);
}

void loop() {
  // send the value of analog input 0:
  Serial.print(analogRead(A0));
  Serial.print(",0,1023");
  Serial.println();
  // wait a bit for the analog-to-digital converter
  // to stabilize after the last reading:
  delay(2);
}

thank you for your reply but how exactly do you send 3 values to the serial plotter? Ive never actually written code (i copied and pasted the code off of a website) so I don't know what you mean by initializie the serial communication or send the value of analog input i can't really code with my lack of expertise if you could explain a little ore that would wonderful

Well the relevant bit was:-

  Serial.print(analogRead(A0));
  Serial.print(",0,1023");

So the 2nd print statement sets bounds on the graph of 0 (minimum) and 1023 (maximum). Just try it :slight_smile:

gopiga:
how exactly do you send 3 values to the serial plotter?

Put all three values on the same line, separated by commas.

I tried that and i finally got it to work thanks guys