mirror of
https://github.com/kidoman/embd
synced 2024-12-22 04:40:04 +01:00
pca9685: bug fixes
This commit is contained in:
parent
c83bd5bf6c
commit
f6ed134486
@ -123,7 +123,7 @@ func (d *PCA9685) SetPwm(channel, onTime, offTime int) (err error) {
|
||||
}
|
||||
|
||||
onTimeHighReg := onTimeLowReg + 1
|
||||
if err = d.Bus.WriteByteToReg(d.Addr, onTimeHighReg, onTimeHighReg); err != nil {
|
||||
if err = d.Bus.WriteByteToReg(d.Addr, onTimeHighReg, onTimeHigh); err != nil {
|
||||
return
|
||||
}
|
||||
if d.Debug {
|
||||
@ -171,7 +171,7 @@ func (d *PCA9685) Close() (err error) {
|
||||
log.Printf("pca9685: cleaning up all PWM control registers")
|
||||
}
|
||||
|
||||
for regAddr := 0x0; regAddr <= 0x45; regAddr++ {
|
||||
for regAddr := 0x06; regAddr <= 0x45; regAddr++ {
|
||||
if err = d.Bus.WriteByteToReg(d.Addr, byte(regAddr), 0x00); err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ func main() {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
pca9685 := pca9685.New(bus, 0x41, 1000)
|
||||
pca9685 := pca9685.New(bus, 0x42, 1000)
|
||||
pca9685.Debug = true
|
||||
defer pca9685.Close()
|
||||
|
||||
if err := pca9685.SetPwm(15, 0, 2000); err != nil {
|
||||
if err := pca9685.SetPwm(0, 0, 2000); err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user