From a32f9312f7fe6e1d37261885ac6cf82afd2c5928 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Tue, 12 Dec 2017 23:37:23 +0100 Subject: [PATCH] testing correct reg_16 --- pca9685.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pca9685.go b/pca9685.go index abc2e8f..60f513f 100644 --- a/pca9685.go +++ b/pca9685.go @@ -182,10 +182,10 @@ func (p *PCA9685) setPwm(pwm int, on uint16, off uint16) { onB := byte(on) offB := byte(off) - p.i2cBus.WriteReg(LED0_ON_L+byte(4)*byte(pwm), []byte{onB & WORD}) - p.i2cBus.WriteReg(LED0_ON_H+byte(4)*byte(pwm), []byte{onB >> 8}) - p.i2cBus.WriteReg(LED0_OFF_L+byte(4)*byte(pwm), []byte{offB & WORD}) - p.i2cBus.WriteReg(LED0_OFF_H+byte(4)*byte(pwm), []byte{offB >> 8}) + p.i2cBus.WriteReg(LED0_ON_L+byte(4)*byte(pwm), []byte{onB & 0xF0}) + p.i2cBus.WriteReg(LED0_ON_H+byte(4)*byte(pwm), []byte{onB & 0x0F}) + p.i2cBus.WriteReg(LED0_OFF_L+byte(4)*byte(pwm), []byte{offB & 0xF0}) + p.i2cBus.WriteReg(LED0_OFF_H+byte(4)*byte(pwm), []byte{offB & 0x0F}) } func (pwm *Pwm) setPercentage(percentage float32) error {