mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add ExtInt wake-up example.
This commit is contained in:
parent
bbe1b53b98
commit
f3eaabfff5
21
scripts/examples/19-Low-Power/extint_wakeup.py
Normal file
21
scripts/examples/19-Low-Power/extint_wakeup.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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(100)
|
||||||
|
led.off()
|
||||||
|
time.sleep(100)
|
||||||
Loading…
Reference in New Issue
Block a user