NEQTO Docs
  • Languages iconEnglish
    • 日本語
  • Docs
  • Region API
  • Global API
  • FAQ

›neqto.js

Getting Started

  • NEQTO Hello World!
  • Step 1. Console Settings
  • Step 2. Device Setting & Start Service

    • When using NEQTO Bridge
    • When using Spresense
  • Step 3. Using Sensors

NEQTO

  • NEQTO Account Registration
  • API Usage
  • Batch Registration
  • Support Guidelines

NEQTO Console

  • Introduction
  • Fundamentals
  • Administrative Actions
  • Device Management
  • Scripts
  • Actions and Contacts
  • NEQTO Apps
  • Machine Driver
  • Recommended Browsers
  • Billing Information

SPRESENSE

    Hardware Specifications

    • 01. About Spresense

    Software Specifications

    • 01. Operational Flow
    • 02. Initial Installation
    • 03. Spresense Wi-Fi Initial Setup
    • 05. Debug Log Acquisition
    • 06. System LED Indications
    • 07. Event Messages
    • 08. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 10. RTC
    • 12. GPIO
    • 13. UART
    • 15. I2C
    • 17. Camera
    • 18. nqSpresense
    • 19. nqService
    • 20. nqMqtt
    • 21. nqFOTA
    • 22. nqWiFi

NEQTO Bridge Series

    Hardware Specifications

    • 01. NEQTO Bridge Module
    • 02. NEQTO Bridge Wi-Fi Module
    • 03. NEQTO Bridge LTE-1 Module
    • 04. NEQTO Bridge LTE-M/NB Module
    • 05. NEQTO Bridge IO Board
    • 06. NEQTO Bridge Digital IO Board

    Software Specifications

    • 01. Operational Flow
    • 02. NEQTO Bridge Wi-Fi Module Initial Setup
    • 03. NEQTO Bridge LTE Module Initial Setup
    • 04. Debug Log Acquisition
    • 05. System LED Indications
    • 06. Event Messages
    • 07. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. UserSW
    • 12. GPIO
    • 13. UART
    • 14. SPI
    • 15. I2C
    • 16. ADC
    • 17. BLE
    • 18. nqBridge
    • 19. nqService
    • 20. nqMqtt
    • 21. nqFOTA
    • 22. nqWiFi
    • 23. nqLte
    • 24. nqLAN
    • 25. nqEx

neqto.js Libraries

    I2C

    • LIS2DW12 v2 Accelerometer
    • HTS221 v2 Temperature and Humidity Sensor
    • [Archive] LIS2DW12 Accelerometer
    • [Archive] HTS221 Temperature and Humidity Sensor

    Integration

    • AWS IoT Core v2 Library
    • AWS S3 v2 Library
    • Azure IoT v2 Library
    • GCP IoT Core Library
    • [Archive] AWS S3 Library
    • [Archive] AWS IoT Core Library

neqto.js Snippets

  • DataDog Snippet
  • Dropbox Snippet
  • Google Sheets Snippet
  • InfluxDB Snippet
  • Oracle Cloud Object Storage Snippet
  • Salesforce Snippet
  • SAP Cloud Platform Internet of Things Snippet
  • Splunk Snippet
  • Niagara Snippet

Release Notes

  • NEQTO Console Updates
  • NEQTO Firmware (Bridge Wi-Fi/LTE Module) Releases
  • NEQTO Firmware (Spresense Wi-Fi) Releases

09. Sleep

The sleep object is a built-in object that provides power saving features.

Functional overview:

  • Supports stop mode.
  • Supports standby mode.
  • Provides the function of reading and writing data to the backup RAM.

For detailed operation of the power saving function, please refer to here.

The backup RAM is the memory that retains the set value even if the power saving mode is entered, as long as power is supplied. If power supply stops, the set value will be lost.



sleep Global Object

Methods()/PropertiesSummaryVersionNote
sleep.setStop()Shuts down the network communication and then transitions to stop mode.00.00.15+
sleep.setStopSync()Immediately transitions to stop mode with network communication maintained.00.00.15+
sleep.setStandby()Shuts down the network communication and then transitions to standby mode.00.00.15+
sleep.setStandbySync()Immediately transitions to standby mode with network communication maintained.00.00.15+
sleep.getEntryResumeControl()Gets the resumeFlag value that was set immediately before.00.00.15+
sleep.setUserRegister()Saves any value to the backup RAM.00.00.15+
sleep.getUserRegister()Gets the value stored in backup RAM.00.00.15+



Details

sleep.setStop(rtcAlarm[,callback])

Shuts down the network communication and then transitions to stop mode.

NameTypeM/OSummary                                        Note
rtcAlarmObjectmandatoryResume time
hour : {number}
Alarm occurrence time [hour]
Range: 0 - 23 (*1)
minute : {number}
Alarm occurrence time [minutes]
Range: 0 - 59 (*1)
second : {number}
Alarm occurrence time [second]
Range: 0 - 59 (*1)
*1: If you do not want to use resume by alarm, specify -1.
callback(flag)functionoptionalExecutes callback processing when an event occurs.
flag : {number}
Indicates the event content.
0: Immediately before transition to stop mode
1: Immediately after returning from stop mode
returnundefined--When an error occurs, an exception is raised.

sleep.setStopSync(rtcAlarm)

Immediately transitions to stop mode with network communication maintained.
During the execution of this method, the immediate transition is made.

NameTypeM/OSummary                                        Note
rtcAlarmObjectmandatoryResume time
hour : {number}
Alarm occurrence time [hour]
Range: 0 - 23 (*1)
minute : {number}
Alarm occurrence time [minutes]
Range: 0 - 59 (*1)
second : {number}
Alarm occurrence time [second]
Range: 0 - 59 (*1)
*1: If you do not want to use resume by alarm, specify -1.
returnundefined--When an error occurs, an exception is raised.

sleep.setStandby(rtcAlarm,resumeFlag[,callback()])

Shuts down the network communication and then transitions to standby mode.

NameTypeM/OSummary                                        Note
rtcAlarmObjectmandatoryResume time
hour : {number}
Alarm occurrence time [hour]
Range: 0 - 23 (*1)
minute : {number}
Alarm occurrence time [minutes]
Range: 0 - 59 (*1)
second : {number}
Alarm occurrence time [second]
Range: 0 - 59 (*1)
*1: If you do not want to use resume by alarm, specify -1.
resumeFlagnumbermandatorySpecify the operation at resume.
0: Normal Resume
Other than 0: Offline Resume
callback()functionoptionalExecutes callback processing immediately before transition to standby mode.
returnundefined--When an error occurs, an exception is raised.

sleep.setStandbySync(rtcAlarm,resumeFlag)

Immediately transitions to standby mode with network communication maintained.
During the execution of this method, the immediate transition is made.

NameTypeM/OSummary                                        Note
rtcAlarmObjectmandatoryResume time
hour : {number}
Alarm occurrence time [hour]
Range: 0 - 23 (*1)
minute : {number}
Alarm occurrence time [minutes]
Range: 0 - 59 (*1)
second : {number}
Alarm occurrence time [second]
Range: 0 - 59 (*1)
*1: If you do not want to use resume by alarm, specify -1.
resumeFlagnumbermandatorySpecify the operation at resume.
0: Normal Resume
Other than 0: Offline Resume
returnundefined--When an error occurs, an exception is raised.

sleep.getEntryResumeControl()

Gets the resumeFlag value that was set immediately before.

NameTypeM/OSummaryNote
returnnumber-resumeFlag valueValues other than 0 are rounded to 1.

sleep.setUserRegister(userValue)

Saves any value to the backup RAM.
It can be used for general purposes.

NameTypeM/OSummaryNote
userValuenumbermandatoryAny value
Range: 0 - 65535 (0x0000 - 0xFFFF)
returnundefined--

sleep.getUserRegister()

Gets the value stored in backup RAM.

NameTypeM/OSummary     Note
returnnumber-Read valueIf power supply stops and the value is lost, or if the value is not set, it will be 0.



Object Usage Examples

Sample 1

This is a sample in stop mode.
Sleep and resume are repeated based on the current time.

var MAX_COUNT = 10;
var count = MAX_COUNT;
while(count-- > 0){
  print('Hello stop-mode');
  var set_date = new Date();
  print('Now time: ' + set_date.toString());
  set_date.setSeconds(set_date.getSeconds() + 30);
  var rtc_time = {hour: set_date.getHours(), minute: set_date.getMinutes(),
  second: set_date.getSeconds()};
  sleep.setStopSync(rtc_time); //Transition to stop mode
  print(Date() + ': resume!!!' + 'count=' + count ); //Executed after returning from stop mode
}

Sample 2

This is a sample in standby mode.
Sleep and resume are repeated based on the current time.

var now_count = sleep.getUserRegister();

var entry_resume = sleep.getEntryResumeControl();
print('entry resume cont.=' + entry_resume);

var MAX_COUNT = 5;
var delay_s = 10;
var set_count;

var now_date = new Date();
print('Now time: ' + now_date.toString());

now_date.setSeconds(now_date.getSeconds() + delay_s);
print('Set time: ' + now_date.toString());

var rtc_time = {hour: now_date.getHours(), minute: now_date.getMinutes(),
second: now_date.getSeconds()};
if (entry_resume == 0){
  set_count = MAX_COUNT;
}else{
  print(Date() + ': resume!!!');
  set_count = --now_count;
}
sleep.setUserRegister(set_count);
if (set_count != 0){
  sleep.setStandby(rtc_time, 1, function(){
    print('standby ready');
  });
}else{
  print('Sleep Finish:');
}



Updated: 2021-02-01
← 08. Storage10. RTC →
  • sleep Global Object
  • Details
    • sleep.setStop(rtcAlarm[,callback])
    • sleep.setStopSync(rtcAlarm)
    • sleep.setStandby(rtcAlarm,resumeFlag[,callback()])
    • sleep.setStandbySync(rtcAlarm,resumeFlag)
    • sleep.getEntryResumeControl()
    • sleep.setUserRegister(userValue)
    • sleep.getUserRegister()
  • Object Usage Examples
    • Sample 1
    • Sample 2
AboutNewsProductsFAQPrivacy Policy}
NEQTO Console
IntroductionFundamentalsAdministrative ActionsDevice Management NEQTO Apps
NEQTO Bridge Series
NEQTO Bridge ModuleNEQTO Bridge Wi-Fi ModuleNEQTO Bridge LTE-1 ModuleError Logging Event Messages
API Documentation
API UsageGlobal APIRegional APIAPI Terms of Service
Jigsaw, Inc.
© 2021 JIG-SAW INC.