Python code for Phidget Stepper
Posted: Wed Sep 08, 2021 7:06 pm
Hi I want to run a python script when a stepper motor stops.
I found example codes on website like this.
I tried but how can I print('stopped') when a stepper motor stops?
I found example codes on website like this.
I tried but how can I print('stopped') when a stepper motor stops?
Code: Select all
from Phidget22.Phidget import *
from Phidget22.Devices.Stepper import *
import time
def onStopped(self):
ch = Stepper()
# Register for event before calling open
ch.setOnStoppedHandler(onStopped)
ch.open()
while True:
# Do work, wait for events, etc.
time.sleep(1)