openmv/scripts/examples/50-Arduino-Boards/Nicla-Vision/53-Low-Power/extint_wakeup.py
iabdalkader 98a29e0870 scripts/examples: Update examples.
- Add examples index.
- Remove RP2040's Bluetooth examples.
- Resort examples.
2023-10-29 21:21:55 +01:00

30 lines
658 B
Python

# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# ExtInt Wake-Up from Stop Mode Example
# This example demonstrates using external interrupts to wake up from low-power mode.
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)
# Enter Stop Mode. Note the IDE will disconnect.
machine.sleep()
while True:
led.on()
time.sleep_ms(100)
led.off()
time.sleep_ms(100)