Serial Plotter only plotting two of the six values

//int A0_Val;
float A0_Val;
//int A1_Val;
float A1_Val;
//int A2_Val;
float A2_Val;
//int A3_Val;
float A3_Val;
//int A4_Val;
float A4_Val;
//int A5_Val;
float A5_Val;

void setup() {
  // put your setup code here, to run once:
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(100);
  A0_Val = analogRead(A0);
  A1_Val = analogRead(A1);
  A2_Val = analogRead(A2);
  A3_Val = analogRead(A3);
  A4_Val = analogRead(A4);
  A5_Val = analogRead(A5);

  //Serial.println("New set of Data begins");
  //Serial.print("\t");
  //Serial.print("A0 value:  ");
  Serial.println(A0_Val);
  Serial.print("\t");
  //Serial.print("A1 value:  ");
  Serial.println(A1_Val);
  Serial.print("\t");
  //Serial.print("A2 value:  ");
  Serial.println(A2_Val);
  Serial.print("\t");
  //Serial.print("A3 value:  ");
  Serial.println(A3_Val);
  Serial.print("\t");
  //Serial.print("A4 value:  ");
  Serial.println(A4_Val);
  Serial.print("\t");
  //Serial.print("A5 value:  ");
  Serial.println(A5_Val);
  //Serial.print("\t");
  
  //need to set up serial plotter correctly, not displaying all variables
}

For some reason when I open the serial plotter using this code it only plots the first two values (A0 and A1). I am fairly certain it is a syntax issue that I am missing with how the serial plotter needs to be structured.

Not sure if this is useful but I'm using the Adafruit Feather M0

Try “,” instead of “\t”

Why are you setting the analogue pins to OUTPUT and then reading from them ?

Serial.println() ends the output to the plotter, so when you do

  Serial.println(A2_Val);

it signals the end of output

1 Like

Should I set them to inputs instead? Or don't set them to anything? I have no reason to set them as outputs. I'm supplying a voltage to each pin and testing them on the plotter for a test board so I figured that was considered an output. I also didn't think this would have any affect on the plotting of the data.

You don't need to use pinMode() at all when using analogRead()

Deal with the Serial.println() problem and you should be good to go

Per

...the format is:

varname1:value varname2:value varname3:value varname4:value 

... if you want user-chosen variable names in the plotter. And if you want auto-generated labels in the legend:

value value value value 

Per that reference, spaces, tabs, or commas as delimiters are all supposed to work.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.