Package pca9685 allows interfacing with the pca9685 16-channel, 12-bit PWM Controller through I2C protocol.



    This section is empty.


    This section is empty.


    This section is empty.


    type PCA9685

    type PCA9685 struct {
    	Bus  embd.I2CBus
    	Addr byte
    	Freq int
    	// contains filtered or unexported fields

      PCA9685 represents a PCA9685 PWM generator.

      func New

      func New(bus embd.I2CBus, addr byte) *PCA9685

        New creates a new PCA9685 interface.

        func (*PCA9685) AnalogChannel

        func (d *PCA9685) AnalogChannel(channel int) *pwmChannel

        func (*PCA9685) Close

        func (d *PCA9685) Close() error

          Close stops the controller and resets mode and pwm controller registers.

          func (*PCA9685) ServoChannel

          func (d *PCA9685) ServoChannel(channel int) *pwmChannel

          func (*PCA9685) SetPwm

          func (d *PCA9685) SetPwm(channel, onTime, offTime int) error

            SetPwm sets the ON and OFF time registers for pwm signal shaping. channel: 0-15 onTime/offTime: 0-4095

            func (*PCA9685) Sleep

            func (d *PCA9685) Sleep() error

              Sleep puts the controller in sleep mode. Does not change the pwm control registers.

              func (*PCA9685) Wake

              func (d *PCA9685) Wake() error

                Wake allows the controller to exit sleep mode and resume with PWM generation.

                Source Files