1
0
mirror of https://github.com/undera/pylgbst.git synced 2020-11-18 19:37:26 -08:00

cosmetics

This commit is contained in:
Andrey Pohilko 2019-04-05 22:08:02 +03:00
parent 5f9ce688e1
commit 3239b3377d

View File

@ -16,7 +16,9 @@ class Automata(object):
def __on_sensor(self, color, distance=-1): def __on_sensor(self, color, distance=-1):
if distance < 4: if distance < 4:
if color not in (COLOR_NONE, COLOR_BLACK):
self._sensor.append((color, int(distance))) self._sensor.append((color, int(distance)))
logging.info("Sensor data: %s", COLORS[color])
def feed_tape(self): def feed_tape(self):
self.__hub.motor_external.angled(120, 0.25) self.__hub.motor_external.angled(120, 0.25)
@ -52,10 +54,11 @@ class Automata(object):
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.DEBUG)
bot = Automata() bot = Automata()
color = COLOR_NONE color = COLOR_NONE
while color != COLOR_RED: while color != COLOR_RED:
bot.feed_tape() bot.feed_tape()
color = bot.get_color() color = bot.get_color()
print (COLORS[color]) print (COLORS[color])
break