Global

The objects are available in a global scope. The objects in the Global are not need to have a require function call before using it.

Object: global

require(module_name)

  • module_name <string>Module Name which would be used in the script.

  • Returns: <any> Return exports object of the loaded module.

// Javascript example: exports PWM module
var PWM = require('pwm').PWM; // PWM module would be used in this script.
var pwm = new PWM(1, 1000, 0.5); // Create the PWM instance with pin 1
  • ...data <any>Data which is shown in the console.

Print out data to the console. The main difference from console.log() is that it do not print a carriage return and a new line character (\r\n) in the end.

// Javascript example: Display a message to the concole.
// print out "100 string value true 1,2,3"
var number = 100;
var result = true;
var arr = [1, 2, 3];
print (number, "string value", result, arr);

encode(binaryData)

  • binaryData <ArrayBuffer|TypedArray|Array<number>|string> Binary data to encode.

  • Returns: <string> Base64 encoded string.

Returns a base64 encoded string from binary data.

decode(encodedData)

  • encodedData <string> Base64 encoded string data.

  • Returns: <ArrayBuffer> Decoded binary data.

Returns a decoded binary data from a base64 encoded string.

encodeURIComponent

  • data <string> Data to encode.

  • Returns: <string> Encoded data.

Encodes URI (Uniform Resource Identifier) component using percent-encoding. This function escapes all characters excepts A-Z a-z 0-9 - _ . ! ~ * ' ( ).

decodeURIComponent

  • data <string> Data to decode.

  • Returns: <string> Decoded data.

Decodes URI (Uniform Resource Identifier) component using percent-encoding.

LOW

  • <number> = 0

HIGH

  • <number> = 1

INPUT

  • <number> = 0

OUTPUT

  • <number> = 1

INPUT_PULLUP

  • <number> = 2

FALLING

  • <number> = 0

RISING

  • <number> = 1

CHANGE

  • <number> = 2

Digital I/O Functions

All the functions in the Digital I/O are in a global scope.

Analog I/O Functions

All the functions in the Analog I/O are in a global scope.

Timers Functions

All the functions in the Timers are in a global scope.

console

  • <Object>

Console object is a global object.

process

  • <Object>

process object is a global object.

board object

  • <Object>

board object is a global object.

storage object

  • <Object>

storage object is a global.

Class: SystemError

  • Extends: {Error}

Represents internal system error.