hi guys , i made this code to operate six servos using variable resistors but it look like it is not working can you check if there is any problem in the code?
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
Servo myservo6;int potpin1 = 0; // analog pin used to connect the potentiometer
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;
int potpin5 = 4;
int potpin6 = 5;int val; // variable to read the value from the analog pin
void setup()
{
myservo1.attach(3); // attaches the servo on pin 9
myservo2.attach(5); // attaches the servo on pin 10
myservo2.attach(6);
myservo2.attach(9);
myservo2.attach(10);
myservo2.attach(11);
}void loop()
{
val = analogRead(potpin1); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo1.write(val); // sets servo according to the scaled value
val = analogRead(potpin2); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo2.write(val); // sets servo according to the scaled value
val = analogRead(potpin3); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo3.write(val); // sets servo according to the scaled value
val = analogRead(potpin4); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo4.write(val); // sets servo according to the scaled value
val = analogRead(potpin5); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo5.write(val); // sets servo according to the scaled value
val = analogRead(potpin6); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo6.write(val); // sets servo according to the scaled value
delay(15); // waits for the servo to get there
}