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

12. GPIO

GPIO objects provide GPIO control functions.

Functional overview:

  • Provides a function to set and control the input / output of the GPIO port.
  • Provides PWM output function.



Abstracts

Methods()/PropertiesSummaryVersionNote
new GPIO()Creates a GPIO instance.00.00.15+

{GPIO} Instance

Methods()/PropertiesSummaryVersionNote
.setMode()Sets the GPIO operation mode.00.00.15+
.getValue()Gets the IO port state.00.00.15+
.setValue()Sets the IO port output.00.00.15+
.setIrq()Sets the IO port input interrupt event.00.00.15+
.disableIrq()Invalidates the IO port input interrupt event set by .setIrq().00.00.15+
.setPwm()Sets the PWM output.00.00.15+
.releasePwm()Stops and invalidates the PWM output set by .setPwm()00.00.15+
.configureWakeup()Sets the wakeup trigger.00.00.23+
.setOnePulse()Outputs one arbitrary pulse.00.00.24+


Details

new GPIO(gpioNo,mode)

Creates a GPIO instance.

NameTypeM/OSummaryNote
gpioNonumbermandatorySpecify the GPIO number.
Please refer to Pinout.
modenumbermandatorySpecify the GPIO operation mode.
Please refer to GPIO operation mode details.
return{GPIO}-{GPIO} : Generated {GPIO}

GPIO operation mode details

modeI/OSummary                                        Note
0INPULL-UP-
1INPULL-DOWN-
2IN-
3OUTPUSH-PULL PULL-UP-
4OUTPUSH-PULL PULL-DOWN-
5OUTPUSH-PULL-
6OUTOPEN-DRAIN PULL-UP-
7OUTOPEN-DRAIN PULL-DOWN-
8OUTOPEN-DRAIN-
9OUTPWMPlease refer to Pinout for the ports that can use the PWM function.

.setMode(mode)

Sets the GPIO operation mode.

NameTypeM/OSummaryNote
modenumbermandatoryGPIO operation mode
Please refer to GPIO operation mode details.
returnboolean-true: Success
false: Failure

.getValue()

Gets the IO port state.

NameTypeM/OSummary             Note
returnnumber-IO port status
0: Low
1: High
If the status cannot be obtained due to the IO port setting, -1 is returned.

.setValue(value)

Sets the IO port output.

NameTypeM/OSummary             Note
valuenumbermandatoryIO port output value
0: Low
1: High
returnboolean-true: Success
false: Failure

.setIrq(edge,callback)

Sets the IO port input interrupt event.
When the specified interrupt condition occurs, the hardware interrupt is triggered and the callback is executed.
It is also used as a resume trigger in stop mode.
In addition, it is not possible to re-set the interrupt event within the interrupt event callback process execution.

For the ports that can use the interrupt function, refer to Pinout.
This function can be used for up to 4 ports.

NameTypeM/OSummaryNote
edgenumbermandatoryInterrupt condition
1: Rising edge
2: Falling edge
3: Rising / Falling edge
callback(value)functionmandatoryExecutes callback processing when an interrupt event occurs.
value : {number}
IO port status at event occurrence
0: Low
1: High
returnboolean-true: Success
false: Failure

.disableIrq()

Invalidates the IO port input interrupt event set by .setIrq().

NameTypeM/OSummaryNote
returnboolean-true: Success
false: Failure

.setPwm(period,pulse)

Sets the PWM (Pulse Width Modulation) output.
Outputs a periodic pulse specified by the period and width.
Specify GPIO operation mode 9 in advance.

The generated PWM signal starts with a Low output.
The Low output is maintained until the duration specified by the pulse width, and then becomes High output until the start of the next pulse period.

NameTypeM/OSummary                        Note
periodnumbermandatoryPulse period [x100us]
Range: 1 - 10000
Some ports have restrictions on the range. Please refer to Pinout and check the notes.
pulsenumbermandatoryPulse width [x100us]
Range: 0 - 10000
Pulse must be less than the period.
returnboolean-true: Success
false: Failure

.releasePwm()

Stops and invalidates the PWM output set by .setPwm().
To enable the PWM control again, specify GPIO operation mode 9 again.

NameTypeM/OSummaryNote
returnboolean-true: Success
false: Failure

.configureWakeup(edge)

Sets the wakeup trigger.
During standby mode, when the wakeup trigger is valid and the specified edge change has occurred, the system will resume.
For the ports that can use the wakeup function, refer to Pinout.

NameTypeM/OSummaryNote
edgenumbermandatorySet the wakeup trigger.
0: Invalid
1: Rising edge
2: Falling edge
Disabled by default.
returnundefined--

.setOnePulse(value1,width1,value2,width2)

Outputs one arbitrary pulse.
This function outputs an arbitrary pulse generated by block type processing by software.
The cycle is not strictly guaranteed like PWM, so please use it after evaluating it.

NameTypeM/OSummaryNote
value1numbermandatory1st signal;
Specify the value to be output to the IO port.
0: Low
1: High
width1numbermandatory1st signal;
Specify the output time [ms] of the IO port.
Range: 0 - 100
If 0 is specified, it will be about 1.2us.
value2numbermandatory2nd signal;
Specify the value to be output to the IO port.
0: Low
1: High
width2numbermandatory2nd signal;
Specify the output time [ms] of the IO port.
Range: 0 - 100
If 0 is specified, it will be about 1.2us.
returnboolean-true: Success
false: Failure



Object Usage Examples

Sample 1

This is a sample that uses interrupts.
When the level of GPIO13 changes from H to L within 10 seconds, the callback is executed.

var gp = new GPIO(13,2);
gp.setIrq(2, function(sts) {
    print('status fall.');
});
setTimeout(function() {
    gp.disableIrq();
    print('timeout!');
}, 10000).wait();

Sample 2

This is a sample that uses PWM control.
Using GPIO11, PWM output of 10ms period and 5ms pulse width is executed for 10 seconds.

var gp = new GPIO(11,9);
gp.setPwm(100, 50);
setTimeout(function() {
    gp.releasePwm();
    print('timeout!');
}, 10000).wait();



Updated: 2021-10-04
← 11. UserSW13. UART →
  • Abstracts
    • {GPIO} Instance
  • Details
    • new GPIO(gpioNo,mode)
    • GPIO operation mode details
    • .setMode(mode)
    • .getValue()
    • .setValue(value)
    • .setIrq(edge,callback)
    • .disableIrq()
    • .setPwm(period,pulse)
    • .releasePwm()
    • .configureWakeup(edge)
    • .setOnePulse(value1,width1,value2,width2)
  • Object Usage Examples
    • Sample 1
    • Sample 2
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.