Example: 50-OpenMV-Boards/50-STM32-Boards/80-Low-Power/extint_wakeup.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 外部中断从停止模式唤醒示例
# 此示例演示了使用外部中断从低功耗模式唤醒。
import time
import pyb
import machine
from pyb import Pin, ExtInt
def callback(line):
pass
led = pyb.LED(3)
pin = Pin("P5", Pin.IN, Pin.PULL_UP)
ext = ExtInt(pin, ExtInt.IRQ_FALLING, Pin.PULL_UP, callback)
# 进入停止模式。注意 IDE 将断开连接。
machine.sleep()
while True:
led.on()
time.sleep_ms(100)
led.off()
time.sleep_ms(100)