def setup():
# Set the GPIO modes to BCM Numbering
GPIO.setmode(GPIO.BCM)
# Set LedPin's mode to output,
# and initial level to high (3.3v)
GPIO.setup(LedPin, GPIO.OUT, initial=GPIO.HIGH)
# Set BtnPin's mode to input,
# and pull up to high (3.3V)
GPIO.setup(BtnPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Set up a falling detect on BtnPin,
# and callback function to swLed
GPIO.add_event_detect(BtnPin, GPIO.FALLING, callback=swLed)
# Define a callback function for button callback
02_buttonControlLed.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录