extint_wakeup.py

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

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)

results matching ""

    No results matching ""