Created
November 23, 2016 13:57
-
-
Save ensonic/bcb0e15b9c9b94cf99bc47b2d6a7c1d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from time import sleep | |
from ev3dev import auto as ev3dev | |
m = ev3dev.LargeMotor(ev3dev.OUTPUT_B) | |
def drive_regulated(): | |
m.run_forever(speed_regulation_enabled='on', speed_sp=10) | |
for x in range(10, 100, 10): | |
v = int((x * m.max_speed) / 100.0) | |
# no effect | |
# m.speed_sp = v | |
# does this have overhead? | |
m.run_forever(speed_sp=v) | |
print(m.speed_sp, m.speed) | |
sleep(0.5) | |
m.stop() | |
def drive_unregulated(): | |
m.run_direct(duty_cycle_sp=1) | |
for x in range(10, 100, 10): | |
v = x | |
# works, yeah! | |
m.duty_cycle_sp = v | |
# not required | |
#m.run_direct(duty_cycle_sp=v) | |
print(m.duty_cycle_sp, m.duty_cycle_sp) | |
sleep(0.5) | |
m.stop() | |
drive_unregulated() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment