extint_wakeup.py

# Ce travail est publié sous licence MIT.
# Copyright (c) 2013-2023 OpenMV LLC. Tous droits réservés.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Exemple de réveil par interruption externe (ExtInt) depuis le mode Stop
# Cet exemple illustre l'utilisation d'interruptions externes pour se réveiller du mode basse consommation.

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


def callback(line):
    pass


led = pyb.LED(3)
pin = Pin("PG12", Pin.IN, Pin.PULL_UP)
ext = ExtInt(pin, ExtInt.IRQ_FALLING, Pin.PULL_UP, callback)

# Entrer en mode Stop. Notez que l'IDE se déconnectera.
machine.sleep()

while True:
    led.on()
    time.sleep_ms(100)
    led.off()
    time.sleep_ms(100)

results matching ""

    No results matching ""