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

Fix issues

This commit is contained in:
Andrey Pohilko 2019-12-27 16:22:37 +03:00
parent f058ece155
commit 1e48f23f61

View File

@ -1,5 +1,5 @@
from pylgbst.constants import COLOR_GREEN, COLOR_NONE from pylgbst.peripherals import COLOR_GREEN, COLOR_NONE
from . import * from vernie import *
robot = Vernie() robot = Vernie()
running = True running = True
@ -11,7 +11,7 @@ def callback(color, distance):
secs = (10 - distance + 1) / 10.0 secs = (10 - distance + 1) / 10.0
print("Distance is %.1f inches, I'm running back with %s%% speed!" % (distance, int(speed * 100))) print("Distance is %.1f inches, I'm running back with %s%% speed!" % (distance, int(speed * 100)))
if speed <= 1: if speed <= 1:
robot.motor_AB.timed(secs / 1, -speed, is_async=True) robot.motor_AB.timed(secs / 1, -speed)
robot.say("Ouch") robot.say("Ouch")
@ -31,6 +31,3 @@ while running:
robot.vision_sensor.unsubscribe(callback) robot.vision_sensor.unsubscribe(callback)
robot.button.unsubscribe(on_btn) robot.button.unsubscribe(on_btn)
robot.led.set_color(COLOR_NONE)
while robot.led.in_progress():
time.sleep(1)