#include <Servo.h>
Servo servo0; // create servo object for servo
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;
Servo servo9;
int potpins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
//analogRead(potpins[0]); // reads first analog pin Not needed
//analogRead(potpins[8]); // reads last analog pin Not needed
int potvals[8]; // this is the same as potvals[] = {0,0,0,0,0,0,0,0};
void setup()
{
servo0.attach(2); // attaches the servo on pin 2 to the servo object
servo1.attach(3); // attaches the servo on pin 3 to the servo object
servo2.attach(4); // attaches the servo on pin 4 to the servo object
servo3.attach(5); // attaches the servo on pin 5 to the servo object
servo4.attach(6); // attaches the servo on pin 6 to the servo object
servo5.attach(7); // attaches the servo on pin 7 to the servo object
servo6.attach(8); // attaches the servo on pin 8 to the servo object
servo7.attach(9); // attaches the servo on pin 9 to the servo object
servo8.attach(10); // attaches the servo on pin 10 to the servo object
servo9.attach(11); // attaches the servo on pin 11 to the servo object
}
void loop()
{
for(int x = 0; x < 9; x++)
{
/*
starts at 0, and works up to 8, potvals[0] = analogRead(potpins[0]); and potvals[1] = analogRead(potpins[1]); etc, until it gets to 8.
*/
potvals[x] = analogRead(potpins[x]); // forgot the ; here
}
delay(18); // waits for the servo to get there
for(int x = 0; x < 9; x++){
Serial.println(potvals[x]); // this will show you what values you've got after reading all of them
}
}
I haven't tested, but should compile.