Adafruit 16-channel PWM Servo Sheild

I bought this to control all the servos on a robotic hand and realized I have no idea how to code with it because it doesn’t use the regular servo commands like servo.Write(). There is a example code that came with it but the code just makes the servos move one at a time and I can’t figure out how to do anything else with it. The only thing about the code are the SERVOMIN and SERVOMAX and that they are the range of the servos. But I dont know how to make it go the the max or min when I want it to. The code makes the servos move in order and loops around and does it again.

I want to be able to control the servos so I can make the hand move and create certain hand signals and whatnot. Any ideas on how to control the servos in a way like servo.write()?

Here is the page on the servo shield.

  This is an example for our Adafruit 16-channel PWM & Servo driver
  Servo test - this will drive 16 servos, one after the other

  Pick one up today in the adafruit shop!

  These displays use I2C to communicate, 2 pins are required to  
  interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4

  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN  150 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  600 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

void setup() {
  Serial.println("16 channel Servo test!");

  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000;
  pulse /= pulselength;
  pwm.setPWM(n, 0, pulse);

void loop() {
  // Drive each servo one at a time
  for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
    pwm.setPWM(servonum, 0, pulselen);
  for (uint16_t pulselen = SERVOMAX; pulselen > SERVOMIN; pulselen--) {
    pwm.setPWM(servonum, 0, pulselen);

  servonum ++;
  if (servonum > 15) servonum = 0;

But I dont know how to make it go the the max or min when I want it to.

Why not? If

    pwm.setPWM(servonum, 0, pulselen);

sets the nth servo to somewhere between SERVOMIN and SERVOMAX, what do you suppose

    pwm.setPWM(servonum, 0, SERVOMIN);


Try this in your experimental program in the loop() part there are two place with:

pwm.setPWM(n, 0, pulse);

replace each with:

pwm.setPWM(n++, 0, pulse); pwm.setPWM(n, 0, pulse);

At the end:

servonum ++;


servonum ++; servonum ++;