This repository has been archived by the owner on Nov 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Using Motors
GongYi edited this page Jul 26, 2014
·
4 revisions
ev3.Motor
class maps to ev3dev /sys/bus/legoev3/devices/out* nodes. Please read ev3dev Using Motor for detail.
You can use integer for all motor speed properties.
regulation_mode
properties is converted to bool
data type.
Depends on the regulation_mode
, python-ev3 write the speed_sp
to either pulses_per_second_sp
or duty_cycle_sp
<td>
duty_cycle_sp
</td>
</tr>
<tr>
<td>
True
</td>
<td>
pulses_per_second_sp
</td>
</tr>
regulation_mode | speed_sp |
False (default) |
from ev3.ev3dev import Motor
d=Motor(port=Motor.PORT.A)
d.run_forever(speed_sp=50)
from ev3.ev3dev import Motor
d=Motor(port=Motor.PORT.A)
d.run_time_limited(time_sp=10000, speed_sp=80)
from ev3.ev3dev import Motor
d=Motor(port=Motor.PORT.A)
d.run_position_limited(position_sp=160, speed_sp=800)
All above methods support no limited number named arguments. You may pass any ev3dev supported motor argument in a single method call by python Named Arguments syntax
from ev3.ev3dev import Motor
d=Motor(port=Motor.PORT.A)
d.run_position_limited(position_sp=160, speed_sp=800)
d.run_time_limited(time_sp=10000, speed_sp=80, regulation_mode=False,
stop_mode=Motor.STOP_MODE.COAST, ramp_up_sp=1000, ramp_down_sp=1000)