Created
August 31, 2016 15:30
-
-
Save Mango-kid/1c05ed1853359f31ff6d1f482b4d5c24 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 | |
import Slush | |
import time | |
b = Slush.sBoard() | |
#define the motor that is being used | |
m1 = Slush.Motor(0) | |
#print the position of the motor before we spin it | |
print("Starting position: " + str(m1.getPosition())) | |
#spin the motor around a little at different speeds | |
m1.run(1, 300) | |
time.sleep(3) | |
m1.run(0, 1000) | |
time.sleep(1) | |
m1.softStop() | |
#print the current position | |
print("Spin position: " + str(m1.getPosition())) | |
#go back to zero and print the position | |
m1.goTo(0) | |
print("Final Position: " + str(m1.getPosition())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment