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