Skip to content

Instantly share code, notes, and snippets.

@Mango-kid
Created March 22, 2018 15:24
Show Gist options
  • Save Mango-kid/48efa955144af9639bdea5885c4803a5 to your computer and use it in GitHub Desktop.
Save Mango-kid/48efa955144af9639bdea5885c4803a5 to your computer and use it in GitHub Desktop.
Using the limt switch manually.
'''
the example uses the move command and the manual limit switch check command. It moves the motor and then checks the limit switch.
this can be used to do fine manual homing
'''
import Slush
#setup the motor
b = Slush.sBoard()
m = Slush.Motor(1)
m.resetDev()
m.setLimitHardStop(0)
m.setCurrent(50, 50, 50, 50)
m.setMaxSpeed(100)
#move until the limit switch is pressed
while m.getSwitch():
m.move(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment