def on_terminate(): RELAY.RESET(0) RELAY.RESET(1) MOTOR.RESET(0) MOTOR.RESET(1) print("All relays and Motors are off.") print("Program has been terminated!")
def main(): # clear old move commands and start fresh, remove power and reset to a know state MOTOR.RESET(0) MOTOR.RESET(1) mqttc = MqttClient('hardware') mqttc.run() atexit.register(on_terminate)
def limitSwitch(self): self.stat = MOTOR.getSENSORS(0) if not (self.stat&0x01) or not (self.stat&0x04): MOTOR.RESET(0) print('Limit switches hit, stopping') root.after_cancel(self._job) self.stopAll()
def resetMotor(self): MOTOR.RESET(0) stat = 0xff while stat: time.sleep(.1) stat = MOTOR.getINTflag0(0) time.sleep(.1)
def stopAll(self): #root.after_cancel(self._job) MOTOR.RESET(0) self.homeComplete = 0 self.vFinal = 0 self.cFinal = 0 self.cycleCount = 0 self.intReset print("Stopping all processes")
def stopAll(self): global intBITS, intFLAG intBITS = MOTOR.getINTflag0(0) intFlag = 0 GPIO.cleanup(22) #root.after_cancel(self._job) MOTOR.RESET(0) self.homeComplete = 0 self.vFinal = 0 self.cFinal = 0 self.cycleCount = 0 print('Stopping all processes')
def stopAll(self): global intBITS, intFLAG intBITS = MOTOR.getINTflag0(0) intFlag = 0 GPIO.cleanup(22) root.after_cancel(self._job) MOTOR.RESET(0) self.homeComplete = 0 self.vFinal = 0 self.cFinal = 0 self.cycleCount = 0 self.direction = 1 self.disableAllbutHome() self.resetClocks() print('Stopping all processes') print('Please re-Home and reset volume and cycles')
def stopAll(self): #global intBITS, intFLAG #intBITS = MOTOR.getINTflag0(0) #intFLAG = 0 self.cancel() #root.after_cancel(self._job) MOTOR.RESET(0) GPIO.cleanup(22) self.homeComplete = 0 self.vFinal = 0 self.vCurrent = 0 self.cFinal = 20 self.cCurrent = 0 self.cycleCount = 0 self.direction = 1 self.disableAllbutHome() self.homeButton["state"] = "normal" self.resetClocks() print('Stopping all processes') print('Please re-Home and reset volume and cycles')
def exitAll(self): MOTOR.RESET(0) GPIO.cleanup(22) sys.exit()
self.top.destroy() class PopupWindowVolume(object): def __init__(self,master): top=self.top=Toplevel(master) self.l=Label(top,text='Remove syringe for motors to move to set volume',font=tkFont.Font(family='Helvetica', size=24),padx=4,pady=4) self.l.pack() self.b=Button(top,text='Move Motors!',height=4,width=12,padx=4,pady=4,font=tkFont.Font(family='Helvetica', size=12),command=self.cleanup) self.b.pack() def cleanup(self): self.top.destroy() #Reset motors MOTOR.RESET(0) MOTOR.enablestepSTOPint(0,'a') MOTOR.enablestepSTOPint(0,'b') MOTOR.intEnable(0) #Initialize Tkinter GUI root = Tk() root.config(bg="black") root.attributes("-fullscreen", TRUE) swidth=root.winfo_screenwidth() sheight=root.winfo_screenheight() #print tkFont.families() container=Frame(root,bg="white") container.place(relx=0.5, rely=0.5, anchor=CENTER) title = headerBLOCK(container,0,0)
def exitAll(self): MOTOR.RESET(0) sys.exit()
# MOTOR.dcSTOP(1,self.mNum) # self.dcState=0 # # def speeddelta(self,val): # #print self.dcState,self.speed.get() # if (self.dcState): # MOTOR.dcSPEED(1,self.mNum,self.speed.get()) # # def UpdateRPM(self): # t=MOTOR.getTACHfine(1,self.mNum) # self.rpm.set(str(t*60/300)) # self.dcm.after(1000,self.UpdateRPM) MOTOR.RESET(0) MOTOR.RESET(1) #root = Tk() root.config(bg="black") root.attributes("-fullscreen", False) root.minsize(width=500, height=700) root.title("Stepper Motor Control") #swidth= root.winfo_screenwidth() # remove comment for full screen #sheight=root.winfo_screenheight() # remove comment for full screen #print tkFont.families() container=Frame(root,bg="white") container.place(relx=0.5, rely=0.5, anchor=CENTER) ma_gui = stepperGUI(container,"Photo Stepper Motor",'a',1,1)
def checkint(self): self.stat = MOTOR.getSENSORS(0) if not self.stat & 0x04: MOTOR.RESET(0) elif not self.stat & 0x01: MOTOR.RESET(0)
def resetCtl(): MOTOR.clrLED(ctl) sleep(2) MOTOR.RESET(ctl) return
def stopAll(self): MOTOR.RESET(0) self.homeComplete = 0 print("stopping")