本文整理汇总了Python中LMK.GPIO.wait_for_edge方法的典型用法代码示例。如果您正苦于以下问题:Python GPIO.wait_for_edge方法的具体用法?Python GPIO.wait_for_edge怎么用?Python GPIO.wait_for_edge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LMK.GPIO
的用法示例。
在下文中一共展示了GPIO.wait_for_edge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWaitForRising
# 需要导入模块: from LMK import GPIO [as 别名]
# 或者: from LMK.GPIO import wait_for_edge [as 别名]
def testWaitForRising(self):
def makehigh():
GPIO.output(LOOP_OUT, GPIO.HIGH)
GPIO.output(LOOP_OUT, GPIO.LOW)
t = Timer(0.1, makehigh)
t.start()
GPIO.wait_for_edge(LOOP_IN, GPIO.RISING)
示例2: testWaitForFalling
# 需要导入模块: from LMK import GPIO [as 别名]
# 或者: from LMK.GPIO import wait_for_edge [as 别名]
def testWaitForFalling(self):
def makelow():
GPIO.output(LOOP_OUT, GPIO.LOW)
GPIO.output(LOOP_OUT, GPIO.HIGH)
t = Timer(0.1, makelow)
t.start()
GPIO.wait_for_edge(LOOP_IN, GPIO.FALLING)
示例3:
# 需要导入模块: from LMK import GPIO [as 别名]
# 或者: from LMK.GPIO import wait_for_edge [as 别名]
import LMK.GPIO as GPIO
import time
#The following pins support the external event detected on the 40Pin Header of the LeMake Guitar
'''P8 P10 P12 P13 P15 P16 P22 P19 P23'''
#The following pins support the external event detected on the 40Pin Header of the BananaPro
'''P7 P8 P10 P11 P13 P15 P16 P18 P19 P21 P22 P23 P24 P26'''
testPinOnGt = 8 #For LeMaker Guitar
testPinonBP = 18 #For BananaPro
GPIO.setmode(GPIO.BOARD)
GPIO.setup(testPinOnGt, GPIO.IN, GPIO.PUD_UP)
if None == GPIO.wait_for_edge(testPinOnGt, GPIO.RISING):
print "specified edge detected"
GPIO.cleanup()
示例4: makehigh
# 需要导入模块: from LMK import GPIO [as 别名]
# 或者: from LMK.GPIO import wait_for_edge [as 别名]
#!/usr/bin/env python
import LMK.GPIO as GPIO
import time
from threading import Timer
PIN_NUM = 12
channel = 7
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN_NUM,GPIO.OUT)
GPIO.output(PIN_NUM,True)
print "\n value_%d = %d\n" %(PIN_NUM,GPIO.input(PIN_NUM))
GPIO.setup(channel,GPIO.IN,GPIO.PUD_DOWN)
print "\n value_%d = %d\n" %(channel,GPIO.input(channel))
def makehigh():
print "\n value_%d = %d\n" %(channel,GPIO.input(channel))
GPIO.output(PIN_NUM,False)
print "\n value_%d = %d\n" %(PIN_NUM,GPIO.input(PIN_NUM))
GPIO.wait_for_edge(channel, GPIO.RISING)
t = Timer(1,makehigh)
t.start()