I'm making a desktop injection molding machine and I thought I'd try Phidgets to control the two stepper motors, four heaters, two thermocouples and a limit switch.
I'm using:
1 x HUB0000 (Maybe an SBC some day)
2 x STC1000
1 x REL1100
1 x TM1101
Right now I'm stuck at step one: Making the steppers rotate. Everything seems to connect fine, and the motors work in the Phidgets control panel and examples, but I can't seem to get them to work using my Python script. The important exerpts are:
Code: Select all
import sys
import time
from Phidget22.Devices.Stepper import *
from Phidget22.PhidgetException import *
from Phidget22.Phidget import *
stp1 = Stepper()
stp1.openWaitForAttachment(1000) #Seems to work fine
stp1.setAcceleration(500000) #Value from console experimenting
stp1.setVelocityLimit(35000) #Value from console experimenting
stp1.setCurrentLimit(1.0) #Didn't see units in API, assuming 1 amp
stp1.setControlMode(0x0) #Verbatim from API documentation, seems weird
stp1.setEngaged(True) #Enable Stepper
stp1.setTargetPosition(10000) #Random trial position from console
time.sleep(5) # Assuming setTargetPosition isn't blocking
stp1.setEngaged(False) #Disable after use