From 88734ec168c7ab7ac7c1b096468f5235c5ff3fe9 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Fri, 11 Nov 2022 22:01:38 +0700 Subject: [PATCH] better handle roaming loop --- kuukar/kuukar_leds.py | 2 +- kuukar/kuukar_motion.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kuukar/kuukar_leds.py b/kuukar/kuukar_leds.py index 38e7d2d..27d46ef 100644 --- a/kuukar/kuukar_leds.py +++ b/kuukar/kuukar_leds.py @@ -79,5 +79,5 @@ class leds: print(leds.__blink_func(self.__get_time(), duration)) time.sleep(0.05) if self.__get_time() > duration: - flashing = False + self.flashing = False break diff --git a/kuukar/kuukar_motion.py b/kuukar/kuukar_motion.py index 8513a6b..9bde2a7 100644 --- a/kuukar/kuukar_motion.py +++ b/kuukar/kuukar_motion.py @@ -110,6 +110,7 @@ class motion: while True: if self.roaming: self.__roam_handle() + time.sleep(0.3) def __roam_handle(self): sensitivity = 35 @@ -149,5 +150,4 @@ class motion: self.turn(-turn_speed, 1) self.drive(drive_speed) if not self.roaming: - self.stop() - time.sleep(0.3) \ No newline at end of file + self.stop() \ No newline at end of file