Finding the maximum and minimum of a servo motor?

So I am trying to move one servo motor that is attached to the PCA9685 servo driver (there are more attached but for now I am trying out one). When I was looking at tutorials, they said to find the minimum and maximum for the servo motor? I am trying out different values for it but I am really unclear because my motor is not moving. I am new to to this, so I am having trouble with it. I have gotten the code based of the example from the Arduino program.

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

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

#define SERVOMIN 150
#define SERVOMAX

uint8_t servonum = 0;

void setup() {

Serial.begin(9600);
Serial.println("8 channel Servo test!");

pwm.begin();

pwm.setPWMFreq(60);//

//yield();

}

void loop() {

pwm.setPWM(0,0,200);
delay(500);

Hello
Well, is think you may start with a very simple tutorial how to get the best out of the sketch for your servo.

Please follow the advice given in the link below when posting code. Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

You have no value for SERVOMAX and you don't use either that or SERVOMIN in the code.

With your code once the servo has moved to 200 it will stay there because you never send it anywhere else. Use the calibration technique from Using the Adafruit Library | Adafruit PCA9685 16-Channel Servo Driver | Adafruit Learning System and edit SERVOMIN/SERVOMAX as described. You don't need to modify the Servo example code just use it.

Steve

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.