extint_wakeup.py

# この作品はMITライセンスの下で提供されています。
# Copyright (c) 2013-2023 OpenMV LLC. 全著作権所有。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# ストップモードからのExtInt復帰の例
# この例では、外部割り込みを使って低消費電力モードから復帰する方法を示します。

import time
import pyb
import machine
from pyb import Pin, ExtInt


def callback(line):
    pass


led = pyb.LED(3)
pin = Pin("D0", 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)

results matching ""

    No results matching ""