Add low power example scripts.

This commit is contained in:
iabdalkader 2017-12-17 16:15:05 +02:00
parent dca8f3781d
commit d1c15610bb
2 changed files with 40 additions and 0 deletions

View 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()

View 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()