예제 #1
0
파일: cp.py 프로젝트: lovedva/B
def pulldowngpio(pinname):
	print ("路由:pulldownGPIO,方法pulldownGPIO打印")
	print ("参数GPIO值:")
	print (pinname)
	print(boardop.getPIN_NUM(pinname))
	boardop.turnoff(boardop.getPIN_NUM(pinname))
	return "LED0 OFF, GPIO17==False "
예제 #2
0
파일: cp.py 프로젝트: lovedva/B
def motord1():
	print ("路由:motord1,方法rotatemotor1打印")
	global cw
	print (cw)
	boardop.turnon(boardop.In1_Motor)
	boardop.turnoff(boardop.In2_Motor)

	return "GPIO13==True GPIO19==False"
예제 #3
0
파일: cp.py 프로젝트: lovedva/B
def heatstop3():
	print("route heatstop3,")
	global ph3
	ph3.terminate()
	global temp3
	temp3.value=-1
	global pwm3
	pwm3.stop()
	global TempOUT1
	boardop.turnoff(TempOUT3)
	boardop.turnoff(TempOUT3)
	return "route heatstop3 finished"
예제 #4
0
파일: cp.py 프로젝트: lovedva/B
def heatstop2():
	print("route heatstop2,")
	global ph2
	ph2.terminate()
	global temp2
	temp2.value=-1
	global pwm2
	pwm2.stop()
	global TempOUT2
	boardop.turnoff(TempOUT2)
	boardop.turnoff(TempOUT2)
	return "route heatstop2 finished"
예제 #5
0
파일: cp.py 프로젝트: lovedva/B
def heatstop1():
	print("route heatstop1,")
	global ph1
	ph1.terminate()
	global temp1
	temp1.value=-1
	global pwm1
	pwm1.stop()
	# pwm1.stop()
	global TempOUT1
	boardop.turnoff(TempOUT1)
	boardop.turnoff(TempOUT1)
	global temp1
	print "temp1 "+str(temp1)
	return "route heatstop1 finished"
예제 #6
0
파일: cp.py 프로젝트: lovedva/B
def mrun():
	global cw
	global ccw
	global stp
	boardop.turnon(boardop.In1_Motor)
	boardop.turnoff(boardop.In2_Motor)
	time.sleep(cw)
	boardop.turnon(boardop.In2_Motor)
	boardop.turnoff(boardop.In1_Motor)
	time.sleep(ccw)
	boardop.turnoff(boardop.In1_Motor)
	boardop.turnoff(boardop.In2_Motor)
	time.sleep(stp)
	print "mrun finished"
예제 #7
0
파일: cp.py 프로젝트: lovedva/B
def mautorun(timelist,loop):
	loop=int(loop)
	for i in range (1,loop+1):
		print str(i)+"次"
		for item in timelist:
			boardop.turnon(boardop.In1_Motor)
			boardop.turnoff(boardop.In2_Motor)
			time.sleep(float(item.get('cw')))
			boardop.turnon(boardop.In2_Motor)
			boardop.turnoff(boardop.In1_Motor)
			time.sleep(float(item.get('ccw')))
			boardop.turnoff(boardop.In1_Motor)
			boardop.turnoff(boardop.In2_Motor)
			time.sleep(float(item.get('stp')))
	print "mautorun finished"
예제 #8
0
파일: cp.py 프로젝트: lovedva/B
def motorstop():
	print ("路由:motorstop,方法motorstop")
	boardop.turnoff(boardop.In1_Motor)
	boardop.turnoff(boardop.In2_Motor)

	return "GPIO13==False\nGPIO19==False"
예제 #9
0
파일: cp.py 프로젝트: lovedva/B
def motord2():
	print ("路由:motord2,方法rotatemotor2")
	boardop.turnon(boardop.In2_Motor)
	boardop.turnoff(boardop.In1_Motor)

	return "GPIO13==False GPIO19==True"
예제 #10
0
파일: cp.py 프로젝트: lovedva/B
# In1_Motor=13   #GPIOXX 
# In2_Motor=19
TempOUT1=14 #60度
TempOUT2=23 #70度 [23]
TempOUT3=16 #90度 [45]

# RPi.GPIO.setup(LED0, RPi.GPIO.OUT)
# RPi.GPIO.setup(In1_Motor, RPi.GPIO.OUT)
# RPi.GPIO.setup(In2_Motor, RPi.GPIO.OUT)
RPi.GPIO.setup(TempOUT1, RPi.GPIO.OUT)
RPi.GPIO.setup(TempOUT2, RPi.GPIO.OUT)
RPi.GPIO.setup(TempOUT3, RPi.GPIO.OUT)

ads1248.init()
boardop.turnon(3) #conversation start
boardop.turnoff(TempOUT1)
boardop.turnoff(TempOUT2)
boardop.turnoff(TempOUT3)
#绑定进程方法
cw=0
ccw=0
stp=0
process=None
ph1=None
ph2=None
ph3=None

manager = BaseManager()
manager.register('PWM', RPi.GPIO.PWM)
manager.start()
pwm1= manager.PWM(TempOUT1,5)