openmv/scripts/examples/OpenMV/19-Low-Power/extint_wakeup.py
iabdalkader 20587f308e Merge time and utime modules.
* Move clock class to utime module.
* Update all examples to be compatible with utime.
2020-11-27 15:44:39 +02:00

22 lines
481 B
Python

# ExtInt Wake-Up from Stop Mode Example
# This example demonstrates using external interrupts to wake up from low-power mode.
import time, pyb, 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)
# Enter Stop Mode. Note the IDE will disconnect.
machine.sleep()
while (True):
led.on()
time.sleep_ms(100)
led.off()
time.sleep_ms(100)