def leftCounterOld(channel):
global leftCount, lastL, intCountL
intCountL += 1
val = GPIO.input(lineLeft)
time.sleep(0.02)
if val == GPIO.input(lineLeft) and val != lastL:
leftCount -= 1
lastL = val
if leftCount <= 0:
p.ChangeDutyCycle(0)
q.ChangeDutyCycle(0)
GPIO.remove_event_detect (channel)
print "Done left", intCountL
评论列表
文章目录