fixed weird 255 max

This commit is contained in:
2017-12-12 23:23:10 +01:00
parent 7a0716e4f0
commit d8612c11c4

View File

@@ -169,8 +169,8 @@ func (p *PCA9685) setPwmFreq(freqHz float32) {
} }
func (p *PCA9685) setAllPwm(on int, off int) { func (p *PCA9685) setAllPwm(on int, off int) {
onB := byte(on) & BYTE onB := byte(on)
offB := byte(off) & BYTE offB := byte(off)
p.i2cBus.WriteReg(ALL_LED_ON_L, []byte{onB & BYTE}) p.i2cBus.WriteReg(ALL_LED_ON_L, []byte{onB & BYTE})
p.i2cBus.WriteReg(ALL_LED_ON_H, []byte{onB & BYTE}) p.i2cBus.WriteReg(ALL_LED_ON_H, []byte{onB & BYTE})
@@ -179,8 +179,8 @@ func (p *PCA9685) setAllPwm(on int, off int) {
} }
func (p *PCA9685) setPwm(pwm int, on int, off int) { func (p *PCA9685) setPwm(pwm int, on int, off int) {
onB := byte(on) & BYTE onB := byte(on)
offB := byte(off) & BYTE offB := byte(off)
p.i2cBus.WriteReg(LED0_ON_L+byte(4)*byte(pwm), []byte{onB & BYTE}) p.i2cBus.WriteReg(LED0_ON_L+byte(4)*byte(pwm), []byte{onB & BYTE})
p.i2cBus.WriteReg(LED0_ON_H+byte(4)*byte(pwm), []byte{onB >> 8}) p.i2cBus.WriteReg(LED0_ON_H+byte(4)*byte(pwm), []byte{onB >> 8})