Skip to content

Commit f306f3f

Browse files
committed
Update EXPLOR3R demo to the new API
1 parent 3a79f78 commit f306f3f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

demo/EXPLOR3R/auto-drive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def backup():
7878
# `run-timed` command will return immediately, so we will have to wait
7979
# until both motors are stopped before continuing.
8080
for m in motors:
81-
m.stop(stop_command='brake')
81+
m.stop(stop_action='brake')
8282
m.run_timed(duty_cycle_sp=-50, time_sp=1500)
8383

8484
# When motor is stopped, its `state` attribute returns empty list.

demo/EXPLOR3R/remote-control.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ def roll(motor, led_group, direction):
6363
def on_press(state):
6464
if state:
6565
# Roll when button is pressed
66-
motor.run_forever(duty_cycle_sp=90*direction)
66+
motor.run_forever(speed_sp=600*direction)
6767
Leds.set_color(led_group, direction > 0 and Leds.GREEN or Leds.RED)
6868
else:
6969
# Stop otherwise
70-
motor.stop(stop_command='brake')
70+
motor.stop(stop_action='brake')
7171
Leds.set(led_group, brightness_pct=0)
7272

7373
return on_press
@@ -87,15 +87,15 @@ def on_press(state):
8787
Sound.speak('Oops, excuse me!')
8888

8989
for motor in (lmotor, rmotor):
90-
motor.stop(stop_command='brake')
90+
motor.stop(stop_action='brake')
9191

9292
# Turn red lights on
9393
for led in (Leds.LEFT, Leds.RIGHT):
9494
Leds.set_color(led, Leds.RED)
9595

9696
# Run both motors backwards for 0.5 seconds
9797
for motor in (lmotor, rmotor):
98-
motor.run_timed(duty_cycle_sp=-90, time_sp=500)
98+
motor.run_timed(speed_sp=-600, time_sp=500)
9999

100100
# Wait 0.5 seconds while motors are rolling
101101
sleep(0.5)

0 commit comments

Comments
 (0)