At the top of DuaneB's code it says this...
#include <Servo.h>
// Sample sketch for driving 12 Servos from an Arduino UNO, servos are attached to digital pins 2,3,4,5,6,7,8,9,10,11,12,13
#define CONNECTED_SERVOS 12
It sweeps a whole load of servos on those pins....
So to attach servos to the board, you control them by putting their yellow / orange wires into those pins.
(The
#define CONNECTED_SERVOS 12 tells it there are 12 and you could reduce that number I guess to just have however servos you have)
This part:
// attach the servos
for(int nServo = 0;nServo < CONNECTED_SERVOS;nServo++)
{
myServos[nServo].attach(SERVO_TO_PIN(nServo));
}
... uses the value of "CONNECTED_SERVOS" which is 12 if you didn't alter it at the top as the upper limit of a counter in a loop and runs the "attach" line as many times as you have servos to as many pins as there are servos.
This is an automated way of doing what I showed you a few posts back where I had something like myservo.attach and anotherservo.attach. The
myServos[nServo] in Duane's code is a way of automating say myServos5 and myServos9 or whatever where nServo is a variable instead of hardcoding the same line a stack of times each with a different number.