3 Replies Latest reply on Sep 20, 2016 2:14 PM by Intel Corporation

    PCA9685 and UPM library

    Thomas Kirven

      I want to use this pwm driver

      https://www.sunfounder.com/modules/pca9685-16-channel-12-bit-pwm-servo-driver.html

      with this library

      upm: PCA9685 Class Reference

       

      to control four ESC's/brushless motors, but I am having trouble getting it to work. I am using ESC's with battery eliminating circuits, so the wire that would be power input for a regular servo is actually a +5v source.

       

      // Instantiate an PCA9685 on I2C bus 0

        upm::PCA9685 *pwm = new upm::PCA9685(1,0x40);

       

        // put device to sleep

        pwm->setModeSleep(true);

        // setup a period of 50Hz

        pwm->setPrescaleFromHz(50);

       

        // wake device up

        if(!pwm->setModeSleep(false)) printf("err1");

        if(!pwm->ledOnTime(0, 0)) printf("err2");

        if(!pwm->ledOffTime(0, 2048)) printf("err3");

       

       

      When I run theses functions they all return successful but I get no output on the driver: the pwm pin on channel 0 is at zero volts, when it should be around 2.5 volts (5*(2048/4096)). Would it be possible that the driver is broken, but the read/write functions to the registers still work?

       

      I would greatly appreciate any help from anyone who has experience with this library.