testing correct reg_16

This commit is contained in:
2017-12-12 23:37:23 +01:00
parent e5a713fadb
commit a32f9312f7

View File

@@ -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 {