rcb

rcb

new rcb(args)

Api constructor. Called by the GUI to start the script (do not use in scripts).
Parameters:
Name Type Description
args Object GUI arguments.
Source:

Classes

console
files
output
sensors

Methods

(static) endScript()

Finishes the script execution. If this function is not called, the user will have to press the "Stop" button to stop the script.
Source:

(static) getBoardId() → {string}

Returns the board's unique ID.
Source:
Returns:
A string representing the board's unique serial number.
Type
string
Example
var boardId = rcb.getBoardId();
rcb.console.print(boardId);
rcb.endScript();

(static) getBoardVersion() → {string}

Returns the board's hardware version.
Source:
Returns:
A string representing the board's hardware version.
Type
string

(static) getFirmwareVersion() → {string}

Returns the board's firmware version.
Source:
Returns:
A string representing the board's firmware version.
Type
string

(static) setDebugMode(enable)

Activates or deactivates the debug mode.
Parameters:
Name Type Description
enable boolean Set to "true" to activate debug mode, "false" otherwise.
Source:

(static) wait(callback, delay)

Waits a certain number of seconds before executing the callback function.
Parameters:
Name Type Description
callback waitDone The function to execute after the delay is over.
delay number Wait delay in seconds (can be floating numbers like 0.1 for 100ms).
Source:
Example
//Illustrates the use of the wait and overwrite functions
rcb.console.print("LEGEND...");
rcb.console.setVerbose(false);
rcb.wait(callback1, 2);

function callback1(){
    rcb.console.overwrite("LEGEND... wait for it...");
    rcb.wait(callback2, 2);
}

function callback2(){
    rcb.console.overwrite("LEGEND... wait for it... DARY!");
    rcb.wait(callback3, 1.5);
}

function callback3(){
    rcb.console.overwrite("LEGENDARY!");
    rcb.endScript();
}