// Include the Servo library
#include <Servo.h>
// Declare the Servo pin
int servoPin[3][3];
//int servoPin [] = {39,44,45,47,48,49,50,52,53} ;
Servo Servo[9]; // Create a servo object *9
void setup() {
// We need to attach the servo to the used pin number
for (int i=0; i<=2; i++){
for (int n=0; n<=2; n++){
Servo[3*i+n].attach(servoPin[i][n]);
}
}
Serial.begin(115200);
servoPin[0][0] = 48;
servoPin[0][1] = 50;
servoPin[0][2] = 49;
servoPin[1][0] = 52;
servoPin[1][1] = 53;
servoPin[1][2] = 44;
servoPin[2][0] = 45;
servoPin[2][1] = 39;
servoPin[2][2] = 47;
}// end setup
void loop(){
tets_servos ();
// Servo[0].write(0);
// delay (500);
// Servo[0].write(90);
// delay (500);
}
void tets_servos (){
for (int i=0; i<=2; i++){
for (int n=0; n<=2; n++){
Serial.print("moving servo # ");
Serial.print(3*i+n);
Serial.print(" on pin ");
Serial.print(servoPin [i][n]);
Serial.println();
Servo[3*i+n].write(0);
delay (500);
Servo[3*i+n].write(90);
delay (500);
}
}
} // end void tets_servos