Deep Sleep Api - Pycom WiPy 3.0 Manual

Hide thumbs Also See for WiPy 3.0:
Table of Contents

Advertisement

6.3.6.1 Deep Sleep API
Deep Sleep API
This chapter describes the library which controls the Deep Sleep Shield. This includes the
controls for external interrupts and timer setup of the deep sleep functionality.
To use this library, please upload the associated Deep Sleep Library to
Pycom device.
Quick Example
from deepsleep import DeepSleep
import deepsleep
ds = DeepSleep()
# get the wake reason and the value of the pins during wake up
wake_s = ds.get_wake_status()
print(wake_s)
if wake_s['wake'] == deepsleep.PIN_WAKE:
print("Pin wake up")
elif wake_s['wake'] == deepsleep.TIMER_WAKE:
print("Timer wake up")
else: # deepsleep.POWER_ON_WAKE:
print("Power ON reset")
ds.enable_pullups('P17') # can also do ds.enable_pullups(['P17', 'P18'])
ds.enable_wake_on_fall('P17') # can also do ds.enable_wake_on_fall(['P17', 'P18'])
ds.go_to_sleep(60) # go to sleep for 60 seconds
DeepSleep
The Deep Sleep Shield allows for waking up via a user trigger and also via an external
interrupt (i.e. Accelerometer, Button).
Constructors
class DeepSleep()
Creates a DeepSleep object, that will control the board's sleep features. For example;
ds = DeepSleep()
on the target
/lib
444

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WiPy 3.0 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

SipyGpyLopyLopy4Fipy

Table of Contents