i have followed the wiring diagram, But the code is was still wrong.
4 of the servos are not even declared, So i changed that, But now a new problem comes up in the error message, expected before; servo1.
Hears the sketch as im upto.
// Servo motor control with potentiometer
// based on example at www.arduino.cc
#include <Servo.h>
Servo servo1; // create an object of type servo 1 to access the methods
int potpin1 = 0; // sets the analog pin 0 to turn on potentiometer 1
int val1; // variable to store the read value of the analog pin 0
Servo servo2; // create an object of type servo 2 to access the methods
int potpin2 = 1; // sets analog pin 1 to switch on potentiometer 2
int val2; // variable to store the read value of the analog pin 1
Servo servo3; // create an object of type servo 3 to access the methods
int potpin3 = 2; // sets the analog pin 2 to turn on the potentiometer 3
int val3; // variable to store the read value of analog pin 2
Servo servo4; // create an object of type servo 4 to access the methods
int potpin4 = 3; // sets the analog pin 3 to turn on the potentiometer 4
int val4; // variable to store the read value of the analogue pin 3
Servo servo5; // create an object of type servo 5 to access the methods
int potpin5 = 4; // sets the analog pin 4 to turn on the potentiometer 5
int val5; // variable to store the read value of analog pin 4
Servo servo6; // create an object of type servo 6 to access the methods
int potpin6 = 5; // sets the analog pin 5 to turn on the potentiometer 6
int val6; // variable to store the read value of analog pin 5
void setup ()
{
servo1.attach (3); // assign arduino pin 3 to be controlled by the object
servo2.attach (4); // assign arduino pin 5 to be controlled by the object
servo3.attach (5); // assign arduino pin 6 to be controlled by the object
servo4.attach (9); // assign arduino pin 9 to be controlled by the object
servo5.attach (10); // assign arduino pin 10 to be controlled by the object
servo6.attach (11); // assign arduino pin 11 to be controlled by the object
}
void loop ()
{
val1 = analogRead (potpin1); // read the value of potentiometer 1 (values between 0 and 1023)
val1 = map (val1, 0, 1023, 0, 185) // scales used by the servo (values between 0 and 180)
servo1.write (val1); // arrow the servo 1 according to the position (scala) read above by analogRead ()
val2 = analogRead (potpin2); // read the value of potentiometer 2 (values between 0 and 1023)
// scales used by the servo (values between 0 and 180)
servo2.write (val2); // arrow the servo 2 according to the position (scala) read above by analogRead ()
val3 = analogRead (potpin3); // read the value of potentiometer 3 (values between 0 and 1023)
val3 = map (val3, 0, 1023, 0, 185) // scales used by the servo (values between 0 and 180)
servo3.write (val3); // arrow the servo 3 according to the position (scala) read above by analogRead ()
val4 = analogRead (potpin4); // read the value of potentiometer 4 (values between 0 and 1023)
val4 = map (val4, 0, 1023, 0, 185) // scales used by the servo (values between 0 and 180)
servo4.write (val4); // arrow the servo 4 according to the position (scala) read above by analogRead ()
val5 = analogRead (potpin5); // read the value of potentiometer 5 (values between 0 and 1023)
val5 = map (val5, 0, 1023, 0, 185) // scales used by the servo (values between 0 and 180)
servo5.write (val5); // arrow the servo 5 according to the position (scala) read above by analogRead ()
val6 = analogRead (potpin6); // read the value of potentiometer 6 (values between 0 and 1023)
// scales used by the servo (values between 0 and 180)
servo6.write (val6); // arrow the servo 6 according to the position (scala) read above by analogRead ()
}
If you start of from scratch from the code that is downloaded from the frizzzzing place the first problem is the servos are not declared and then son and so on.
Im a little stuck is all.