edge.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:TanzoBot 作者: tanzilli 项目源码 文件源码
def main():

    GPIO.setmode(GPIO.BOARD)
    GPIO.setwarnings(False)

    GPIO.setup(LAMP_SX, GPIO.OUT)
    GPIO.setup(LAMP_DX, GPIO.OUT)

    GPIO.output(LAMP_SX, 0)
    GPIO.output(LAMP_DX, 0)

    GPIO.setup(INT_SX, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(INT_DX, GPIO.IN, pull_up_down=GPIO.PUD_UP)

    GPIO.add_event_detect(INT_SX, GPIO.BOTH, callback=handler_int_sx, bouncetime=100)
    GPIO.add_event_detect(INT_DX, GPIO.BOTH, callback=handler_int_dx, bouncetime=100)

    try:  

        #Entro in un loop infinito dove conto i secondi che passano
        while True:
            time.sleep(1)

    except KeyboardInterrupt:  
        print "Exit"    
        GPIO.cleanup()       # clean up GPIO on CTRL+C exit  

    GPIO.cleanup()           # clean up GPIO on normal exit
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号