From 3239b3377d9cb6aff4c5d4e0c6cebff049d1200d Mon Sep 17 00:00:00 2001 From: Andrey Pohilko Date: Fri, 5 Apr 2019 22:08:02 +0300 Subject: [PATCH] cosmetics --- examples/automata/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/automata/__init__.py b/examples/automata/__init__.py index e477f84..4783adc 100644 --- a/examples/automata/__init__.py +++ b/examples/automata/__init__.py @@ -16,7 +16,9 @@ class Automata(object): def __on_sensor(self, color, distance=-1): if distance < 4: - self._sensor.append((color, int(distance))) + if color not in (COLOR_NONE, COLOR_BLACK): + self._sensor.append((color, int(distance))) + logging.info("Sensor data: %s", COLORS[color]) def feed_tape(self): self.__hub.motor_external.angled(120, 0.25) @@ -52,10 +54,11 @@ class Automata(object): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=logging.DEBUG) bot = Automata() color = COLOR_NONE while color != COLOR_RED: bot.feed_tape() color = bot.get_color() print (COLORS[color]) + break