Python关于KeyboardInterrupt的问题

##Python关于KeyboardInterrupt的问题

Python关于KeyboardInterrupt的问题_第1张图片

对于按下按键CTRL+C后,程序不停止,led1和led2来回循环。
这样情况下就要加入try: except KeyboardInterrupt as results:

import RPi.GPIO  as GPIO
import time
def led2():
    # led1=31 # led2=15  # beep=29  # fan=32  # key=33
    led1 = 31
    led2 = 

你可能感兴趣的:(Key,python)