always convert pwm value to int
This commit is contained in:
parent
e41b4c69d8
commit
5adb74082a
|
@ -27,9 +27,9 @@ class motion:
|
|||
def motor_write(self, forward_pin: int, reverse_pin: int, speed: int):
|
||||
if speed < 0:
|
||||
self.drv.pwm_write(forward_pin, 0)
|
||||
self.drv.pwm_write(reverse_pin, -speed)
|
||||
self.drv.pwm_write(reverse_pin, -int(speed))
|
||||
elif speed >= 0:
|
||||
self.drv.pwm_write(forward_pin, speed)
|
||||
self.drv.pwm_write(forward_pin, int(speed))
|
||||
self.drv.pwm_write(reverse_pin, 0)
|
||||
|
||||
def drive(self, speed: int):
|
||||
|
|
Loading…
Reference in New Issue