mirror of
https://github.com/undera/pylgbst.git
synced 2020-11-18 19:37:26 -08:00
Fix LED and vision sensor demos (#30)
This commit is contained in:
parent
02d1ca0188
commit
e60002a728
@ -13,7 +13,7 @@ log = logging.getLogger("demo")
|
|||||||
def demo_led_colors(movehub):
|
def demo_led_colors(movehub):
|
||||||
# LED colors demo
|
# LED colors demo
|
||||||
log.info("LED colors demo")
|
log.info("LED colors demo")
|
||||||
movehub.color_distance_sensor.subscribe(lambda x, y: None)
|
movehub.led.subscribe(lambda x, y: None)
|
||||||
for color in list(COLORS.keys())[1:] + [COLOR_BLACK]:
|
for color in list(COLORS.keys())[1:] + [COLOR_BLACK]:
|
||||||
log.info("Setting LED color to: %s", COLORS[color])
|
log.info("Setting LED color to: %s", COLORS[color])
|
||||||
movehub.led.set_color(color)
|
movehub.led.set_color(color)
|
||||||
@ -111,11 +111,11 @@ def demo_color_sensor(movehub):
|
|||||||
demo_color_sensor.cnt += 1
|
demo_color_sensor.cnt += 1
|
||||||
log.info("#%s/%s: Color %s, distance %s", demo_color_sensor.cnt, limit, COLORS[color], distance)
|
log.info("#%s/%s: Color %s, distance %s", demo_color_sensor.cnt, limit, COLORS[color], distance)
|
||||||
|
|
||||||
movehub.color_distance_sensor.subscribe(callback)
|
movehub.vision_sensor.subscribe(callback)
|
||||||
while demo_color_sensor.cnt < limit:
|
while demo_color_sensor.cnt < limit:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
movehub.color_distance_sensor.unsubscribe(callback)
|
movehub.vision_sensor.unsubscribe(callback)
|
||||||
|
|
||||||
|
|
||||||
def demo_motor_sensors(movehub):
|
def demo_motor_sensors(movehub):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user