#include <Servo.h>
#define NUM_SERVOS 6
Servo myServo[NUM_SERVOS];
void setup()
{
// put your setup code here, to run once:
for( int i=0; i<NUM_SERVOS; i++)
{
myServo[i].attach( i + 42);
}
}
void loop()
{
// Sequence two.
// All servo motors move with the same angle.
for( int i=0; i<NUM_SERVOS; i++)
{
myServo[i].write( 0); // set to begin position (horn is rotated left)
}
delay( 1); // wait to let the viewer get used to it
for( int a=0; a<3; a++)
{
for( int r=0; r<=180; r++) // move horns to the right
{
for( int i=0; i<NUM_SERVOS; i++)
{
myServo[i].write( r);
}
delay( 1);
}
for( int r=180; r>=0; r--)
{
for( int i=0; i<NUM_SERVOS; i++) // move horns to the left
{
myServo[i].write( r);
}
delay( 1);
}
}
}