From 5adb74082a2960a024d04df2d26e3820a386362d Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Thu, 10 Nov 2022 22:46:25 +0700 Subject: [PATCH] always convert pwm value to int --- kuukar/kuukar_motion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kuukar/kuukar_motion.py b/kuukar/kuukar_motion.py index f3dac78..3b987f1 100644 --- a/kuukar/kuukar_motion.py +++ b/kuukar/kuukar_motion.py @@ -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):