Skip to content

Instantly share code, notes, and snippets.

@Mango-kid
Created August 31, 2016 15:30
Show Gist options
  • Save Mango-kid/1c05ed1853359f31ff6d1f482b4d5c24 to your computer and use it in GitHub Desktop.
Save Mango-kid/1c05ed1853359f31ff6d1f482b4d5c24 to your computer and use it in GitHub Desktop.
#!/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