Created
August 20, 2015 19:31
-
-
Save thekitchenscientist/e5b828c0abe114112130 to your computer and use it in GitHub Desktop.
Basic motor control by direct command on Linux
This file contains 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
import time | |
# command to start motor on port A at speed 20 | |
start_motor = '\x0C\x00\x00\x00\x80\x00\x00\xA4\x00\x01\x14\xA6\x00\x01' | |
# command to stop motor on port A | |
stop_motor = '\x09\x00\x01\x00\x80\x00\x00\xA3\x00\x01\x00' | |
# send commands to EV3 via bluetooth | |
with open('/dev/rfcomm0', 'w', 0) as bt: | |
bt.write(start_motor) | |
time.sleep(5) | |
bt.write(stop_motor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment