PCA9685


The PCA9685 is a PWM and servo driver breakout board with 16 channels.

For more information click here.

How To Connect

var Cylon = require("cylon");

Cylon.robot({
    connections: {
        raspi: {
            adaptor: 'raspi'
        }
    },

    devices: {
        pca9685: {
            driver: 'pca9685'
        }
    },
});

How To Use

var Cylon = require("cylon");

Cylon.robot({
    connections: {
        raspi: {
            adaptor: 'raspi'
        }
    },

    devices: {
        pca9685: {
            driver: 'pca9685'
        }
    },

    work: function(my) {

        var min = 700;
        var max = 1100;

        // set the frequency to 60hz
        my.pca9685.setPWMFreq(60);

        // rotate to and hold the minium position
        my.pca9685.setPWM(0, 0, min);

        after((5).seconds(), function() {
            // rotate to and hold the maxium position
            my.pca9685.setPWM(0, 0, max);
        });

        after((10).seconds(), function() {
            // reset and stop all outputs
            my.pca9685.stop();
        });
    }
}).start();

Commands

setPWMFreq

Set the servo frequency for the PCA9685

Params

  • frequency (number) frequency to write

  • [callback] (function) function to be invoked when done

Returns

  • (undefined)

setPWM

Set the servo position for the PCA9685

Params

  • channel (number) channel to write to

  • pulseon (number) pulse on to set

  • pulseoff (number) pulse off to set

  • [callback] (function) function to be invoked when done

Returns

  • (undefined)

Compatibility