How to read several potentiometer values

Here is the code

#include <Servo.h>

Servo myservo1;  // create servo object to control a servo
Servo myservo2;  // create servo object to control a servo
Servo myservo3;  // create servo object to control a servo
Servo myservo4;  // create servo object to control a servo

int potval1;    // variable to read the value from the analog pin
int potval2;
int potval3;
int potval4;

void setup() {
  Serial.begin(38400);
  myservo1.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo2.attach(10);
  myservo3.attach(5);
  myservo2.attach(6);
}

void loop() {
  potval1 = map(analogRead(0), 0, 1023, 0, 180);   // reads the value of the potentiometer (value between 0 and 1023)
  potval2 = map(analogRead(1), 0, 1023, 0, 180); 
  potval3 = map(analogRead(2), 0, 1023, 0, 180);
  potval4 = map(analogRead(4), 0, 1023, 0, 180); 
  
  myservo1.write(potval1);   // sets the servo position according to the scaled value
  Serial.print("X");
  Serial.println(potval1);
  myservo2.write(potval2); 
  Serial.print("Y");
  Serial.println(potval2);
  myservo3.write(potval3); 
  Serial.print("Z");
  Serial.println(potval3);
  myservo4.write(potval4); 
  Serial.print("V");
  Serial.println(potval4);
  
  delay(10);  // waits for the servo to get there
}

I’m only getting one line of values with all of them meddled with each other and would like to see all of them separately.

Why not just add some spaces, or some newlines?

Some multi pot/servo test code.

//zoomkat multi pot/servo test 3-23-13
//includes dead band for testing and limit servo hunting
//view output using the serial monitor

#include <Servo.h> 
Servo myservo1;  //declare servos
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;

int potpin1 = 0;  //analog input pin A0
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;
int potpin5 = 4;

int newval1, oldval1;  //pot input values
int newval2, oldval2;
int newval3, oldval3;
int newval4, oldval4;
int newval5, oldval5;

void setup() 
{
  Serial.begin(9600);  
  myservo1.attach(2);  
  myservo2.attach(3);
  myservo3.attach(4);
  myservo4.attach(5);
  myservo5.attach(6);
  Serial.println("testing multi pot servo");  
}

void loop()
{ 
  newval1 = analogRead(potpin1);           
  newval1 = map(newval1, 0, 1023, 0, 179); 
  if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){ //dead band 
    myservo1.write(newval1); //position the servo
    Serial.print("1- ");
    Serial.println(newval1); //print the new value for testing 
    oldval1=newval1; //set the current old value
  }

  newval2 = analogRead(potpin2);
  newval2 = map(newval2, 0, 1023, 0, 179);
  if (newval2 < (oldval2-2) || newval2 > (oldval2+2)){  
    myservo2.write(newval2);
    Serial.print("2- ");    
    Serial.println(newval2);
    oldval2=newval2;
  }

  newval3 = analogRead(potpin3);           
  newval3 = map(newval3, 0, 1023, 0, 179); 
  if (newval3 < (oldval3-2) || newval3 > (oldval3+2)){  
    myservo3.write(newval3);
    Serial.print("3- ");
    Serial.println(newval3);
    oldval3=newval3;
  }

  newval4 = analogRead(potpin4);           
  newval4 = map(newval4, 0, 1023, 0, 179); 
  if (newval4 < (oldval4-2) || newval4 > (oldval4+2)){  
    myservo4.write(newval4);
    Serial.print("4- ");
    Serial.println(newval4);
    oldval4=newval4;
  }

  newval5 = analogRead(potpin5);           
  newval5 = map(newval5, 0, 1023, 0, 179); 
  if (newval5 < (oldval5-2) || newval5 > (oldval5+2)){  
    myservo5.write(newval5);
    Serial.print("5- ");
    Serial.println(newval5);
    oldval5=newval5;
  } 
  delay(50);  //to slow loop for testing
}
if (debug_active == true) {
      if (debugFFTpin == true) {
      Serial.print(pix1); Serial.print("\t");
      Serial.print(pix2); Serial.print("\t");
      Serial.print(pix3); Serial.print("\t");
      Serial.print(pix4); Serial.print("\t");
      Serial.print(pix5); Serial.print("\t");

      Serial.println();

There is a way to combine all these into a neat one liner but uses sprintf or something and the syntax is complex. The code above will produce tabbed results, works well for my FFT code when I'm trying to view multiple bins.

Alright, thanks a lot. I'll try them soon.

There's code attached to this post which will smoothly control servos based on potentiometer input.

The code is setup to use two pots and two servos but it can easily be changed to use as many pots as you have analog inputs.

Here's a video of the position control code in action.

Here's a video of the speed control code being demonstrated.

There are lots of parameters you could adjust to "tune" the pots/servos to behave the way you like.