PCA9865 not able to set servo to rotate


PCA9865 Arduino Uno
GND GND
SCL SCL
SDA SDA
VCC 5V
Am using one servo motor so connected to 5v pin of arduino to vcc.

Code i used from arduino examples:
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40);
#define SERVOMIN 0 // 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.begin(9600);
Serial.println("16 channel Servo test!");
Serial.print("servo number ");
Serial.print(servonum);

pwm.begin();

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

yield();
}
void loop() {
// Drive each servo one at a time
//Serial.println(servonum);
if(servonum == 0) {
Serial.println(servonum);
for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
pwm.setPWM(servonum, 0, pulselen);
Serial.println(pwm.getPWM(0));
}

delay(500);

servonum ++;
if (servonum > 0) servonum = 1;
}
}
After setting PWM i tried printing by getpwm(0) , result is o at all points.
21:25:33.277 -> 0
KIndly suggest.. is there problem with board?

Servo works fine since i tried connecting directly with arduino with servo library and rotating fine.

I2C scanner is detecting fine too!

Have you tried any of the example programs that come with the library? pwmtest for example.

Hello ,
The above code is from example from library for servo.
Just to be sure tried i2c scanner too.

Why set to 1? Isn't your servo in position 0?

Steve

Hello ,

Just to avoid running in loop. Not necessary as we have the condition of servonum =0.
Servo channel am using is 0

PIcture isn't easy to see but you don't seem to have any servo power connection to the PCA board. Just power to the electronics. See Overview | Adafruit PCA9685 16-Channel Servo Driver | Adafruit Learning System "The VCC pin is just power for the chip itself. If you want to connect servos or LEDs that use the V+ pins, you MUST connect the V+ pin as well."

Steve

Hi Rossan,

if you have difficulties to write in english use google-translate.
You will get your problems solved faster if you write with more details

https://translate.google.de/?hl&ie=UTF-8

best regards Stefan