Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # init stepper motor A
- def StepperMotorAInit(self):
- WriteByte(TB_1A_MODE, TB_SPM) #Stepper
- time.sleep(DelayTime)
- WriteHalfWord(TB_1A_DUTY, 1000) # voltage
- time.sleep(DelayTime)
- # MoveSteps > 0 CW
- # MoveSteps < 0 CCW
- # StepDelayTime : delay time for every step. uint us
- def StepperMotorAMove(self, MoveSteps, StepDelayTime):
- if MoveSteps > 0:
- WriteByte(TB_1A_DIR, TB_CW) #CW
- else:
- WriteByte(TB_1A_DIR, TB_CCW) #CW
- MoveSteps = -MoveSteps
- time.sleep(DelayTime)
- WriteOneWord(TB_1A_SPM_SPEED, StepDelayTime) # unit us
- time.sleep(DelayTime)
- WriteOneWord(TB_1A_SPM_STEP, MoveSteps)
- time.sleep(DelayTime)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement