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

›neqto.js

Getting Started

  • NEQTO Hello World!
  • Tutorial Step 1. NEQTO Console Setting
  • Tutorial Step 2. Device Settings & Launching Service (NEQTO Bridge)
  • Tutorial Step 2. Device Settings & Launching Service (STM32 Discovery)
  • Tutorial Step 2. Device Settings & Launching Service (SPRESENSE)
  • Tutorial Step 3. Application development using scripts

NEQTO

  • NEQTO Account Registration
  • Sub-accounts
  • API Usage
  • NEQTO CloudSync for GCP
  • NEQTO Engine Firmware List
  • Support Guidelines

NEQTO Console

  • Introduction
  • Fundamentals
  • Administrative Actions
  • Device Management
  • Linux-based Device Management
  • Batch Registration
  • Scripts
  • Actions and Contacts
  • View Data from the Console
  • NEQTO Apps

    • About NEQTO Apps
    • NEQTO Infinitypool
    • NEQTO Insights
    • NEQTO Custodia
    • NEQTO Flow
  • 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
    • 04. Spresense LTE-M 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
    • 09. Sleep
    • 10. RTC
    • 11. GPIO
    • 12. UART
    • 13. SPI
    • 14. I2C
    • 15. ADC
    • 16. GNSS
    • 17. Camera
    • 18. Utils
    • 19. nqSpresense
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi
    • 24. nqLte

STM32 Discovery

    Hardware Specifications

    • 01. About STM32 Discovery Kit (B-L4S5I-IOT01A)

    Software Specifications

    • 01. Operational Flow
    • 02. Initial Installation
    • 03. STM32 Discovery Wi-Fi 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
    • 18. Utils
    • 19. nqDiscovery
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi

NEQTO Bridge

    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
    • 07. NEQTO Bridge Connector 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. Utils
    • 19. nqBridge
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi
    • 24. nqLte
    • 25. nqLAN
    • 26. nqEx

Linux-based device

    Software Specifications

    • 01. System Requirements
    • 02. Installation
    • 03. Software Configurations
    • 04. Operational Flow
    • 05. Debug Log Acquisition
    • 06. Event Messages
    • 07. Updating Software

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. RTC
    • 10. UNIXSocket
    • 11. FileSystem
    • 12. SubProcess
    • 13. Utils
    • 14. nqLinux
    • 15. nqService
    • 16. nqMqtt
    • 17. nqFOTA
    • 18. nqLAN

neqto.js Libraries

  • About neqto.js Libraries
  • UART

    • GM65 Barcode Reader
    • SRF Ultrasonic Range Finder - Serial Mode

    I2C

    • HTS221 v2 Temperature and Humidity Sensor
    • LIS2DW12 v2 Accelerometer
    • SRF Ultrasonic Range Finder - I2C Mode
    • [Archive] HTS221 Temperature and Humidity Sensor
    • [Archive] LIS2DW12 Accelerometer

    Utils

    • RTC Alarm Synchronized Scheduler

    Integration

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

neqto.js Snippets

  • About neqto.js Snippets
  • DataDog
  • Dropbox
  • Google Sheets
  • InfluxDB
  • Oracle Cloud Object Storage
  • Salesforce
  • SAP Cloud Platform Internet of Things
  • Splunk
  • Niagara

Release Notes

  • NEQTO Console Updates
  • NEQTO Firmware (Bridge Wi-Fi/LTE Module) Releases
  • NEQTO Firmware (STM32 Discovery Wi-Fi) Releases
  • NEQTO Firmware (Spresense Wi-Fi/LTE-M) Releases
  • NEQTO Engine for Linux Releases

09. Sleep

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

Functional overview:

  • Supports the Spresense Cold Sleep and Deep Sleep modes as the standby mode.
  • Provides the function of reading and writing data to the backup RAM.
  • Provides a function to control wireless communications.

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. The backup RAM is only available when using the Cold Sleep mode. In Deep Sleep mode, the set value is not retained.



sleep Global Object

Methods()/PropertiesSummaryVersionNote
sleep.setStandby()Shuts down the network communication and then transitions to standby mode.02.00.00+
sleep.setStandbySync()Immediately transitions to standby mode with forced network communication shutdown.02.00.00+
sleep.getEntryResumeControl()Gets the resumeFlag value that was set immediately before.02.00.00+
sleep.setUserRegister()Saves any value to the backup RAM.02.00.00+
sleep.getUserRegister()Gets the value stored in backup RAM.02.00.00+
sleep.setRadio()Sets enable/disable wireless communication.02.00.00+
sleep.setRadioSync()Sets enable/disable wireless communication.02.00.00+



Details

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 (Cold Sleep)
1: Offline Resume (Cold Sleep)
Other than: Normal Resume (Deep Sleep)
(***) is the sleep mode of the Spresense used.
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 forced network communication shutdown.

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 (Cold Sleep)
1: Offline Resume (Cold Sleep)
Other than: Normal Resume (Deep Sleep)
(***) is the sleep mode of the Spresense used.
returnundefined--When an error occurs, an exception is raised.

sleep.getEntryResumeControl()

Gets the resumeFlag value that was set immediately before.

NameTypeM/OSummaryNote
returnnumber-resumeFlag valueIf the power supply stops and the value disappears, or after a resume from Deep Sleep mode, it becomes 0.

sleep.setUserRegister(userValue)

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

NameTypeM/OSummaryNote
userValuenumbermandatoryAny value
Range: 0 - 4294967295 (0x00000000 - 0xFFFFFFFF)
returnundefined--

sleep.getUserRegister()

Gets the value stored in backup RAM.

NameTypeM/OSummary     Note
returnnumber-Read valueIf the power supply stops and the value disappears, or after a resume from Deep Sleep mode, it becomes 0.

sleep.setRadio(ctrl[,callback])

Sets enable/disable wireless communication.

NameTypeM/OSummary                                 Note
ctrlnumbermandatoryWireless Communication Settings
0: Wireless communication OFF
1: Wireless communication ON
If Wireless Communication OFF is specified, services and functions using the network will not be available. To recover, it is necessary to return to the Wireless Communication ON setting.
callback()functionoptionalExecutes callback processing when the specified wireless communication setting is completed.
returnundefined--When an error occurs, an exception is raised.

sleep.setRadioSync(ctrl)

Sets enable/disable wireless communication.
During the execution of this method, the immediate transition is made.

NameTypeM/OSummary                                 Note
ctrlnumbermandatoryWireless Communication Settings
0: Wireless communication OFF
1: Wireless communication ON
If Wireless Communication OFF is specified, services and functions using the network will not be available. To recover, it is necessary to return to the Wireless Communication ON setting.
returnundefined--When an error occurs, an exception is raised.



Object Usage Examples

Sample 1

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: 2022-06-03
← 08. Storage10. RTC →
  • sleep Global Object
  • Details
    • sleep.setStandby(rtcAlarm,resumeFlag[,callback])
    • sleep.setStandbySync(rtcAlarm,resumeFlag)
    • sleep.getEntryResumeControl()
    • sleep.setUserRegister(userValue)
    • sleep.getUserRegister()
    • sleep.setRadio(ctrl[,callback])
    • sleep.setRadioSync(ctrl)
  • Object Usage Examples
    • Sample 1
AboutNewsProductsFAQPrivacy Policy}
NEQTO Console
IntroductionFundamentalsAdministrative ActionsDevice Management NEQTO Apps
NEQTO Bridge
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.
© 2023 JIG-SAW INC.