mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add low power example scripts.
This commit is contained in:
parent
dca8f3781d
commit
d1c15610bb
21
usr/examples/19-Low-Power/deep_sleep.py
Normal file
21
usr/examples/19-Low-Power/deep_sleep.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Deepsleep Mode Example
|
||||||
|
# This example demonstrates using the low-power Deepsleep Mode.
|
||||||
|
# Note the camera will reset after wake-up from deep sleep. To find out if the cause of reset
|
||||||
|
# is deep sleep, call the machine.reset_cause() function and test for machine.DEEPSLEEP_RESET
|
||||||
|
import pyb, machine
|
||||||
|
|
||||||
|
# Create and init RTC object.
|
||||||
|
rtc = pyb.RTC()
|
||||||
|
|
||||||
|
# (year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
|
||||||
|
rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
|
||||||
|
|
||||||
|
# Print RTC info.
|
||||||
|
print(rtc.datetime())
|
||||||
|
|
||||||
|
# Enable RTC interrupts every 5 seconds.
|
||||||
|
# Note the camera will RESET after wakeup from Deepsleep Mode.
|
||||||
|
rtc.wakeup(5000)
|
||||||
|
|
||||||
|
# Enter Deepsleep Mode.
|
||||||
|
machine.deepsleep()
|
||||||
19
usr/examples/19-Low-Power/stop_mode.py
Normal file
19
usr/examples/19-Low-Power/stop_mode.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Stop Mode Example
|
||||||
|
# This example demonstrates using the low-power Stop Mode.
|
||||||
|
|
||||||
|
import time, pyb, machine
|
||||||
|
|
||||||
|
# Create and init RTC object.
|
||||||
|
rtc = pyb.RTC()
|
||||||
|
# (year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
|
||||||
|
rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
|
||||||
|
|
||||||
|
# Print RTC info.
|
||||||
|
print(rtc.datetime())
|
||||||
|
|
||||||
|
# Enable RTC interrupts every 5 seconds.
|
||||||
|
rtc.wakeup(2000)
|
||||||
|
|
||||||
|
# Enter Stop Mode.
|
||||||
|
# Note the IDE will disconnect.
|
||||||
|
machine.sleep()
|
||||||
Loading…
Reference in New Issue
Block a user