The right button on the hub
Example
var hub = serviceSPIKE.PrimeHub();
var right_button = hub.right_button;
// do something with right_button
Methods
-
static wait_until_pressed(callback)
-
execute callback after this button is pressed
Parameters:
Name Type Description callback
function function to run when button is pressed
Example
var hub = new serviceSPIKE.PrimeHub(); var right_button = hub.right_button; right_button.wait_until_pressed ( function () { console.log("right_button was pressed"); })
-
static wait_until_released(callback)
-
execute callback after this button is released
Parameters:
Name Type Description callback
function function to run when button is released
Example
var hub = new serviceSPIKE.PrimeHub(); var right_button = hub.right_button; right_button.wait_until_released ( function () { console.log("right_button was released"); })
-
static was_pressed() → {boolean}
-
Tests to see whether the button has been pressed since the last time this method called.
Returns:
boolean -- True if was pressed, false otherwise
Example
var hub = new serviceSPIKE.PrimeHub(); if ( hub.right_button.was_pressed() ) { console.log("right_button was pressed"); }
-
static is_pressed() → {boolean}
-
Tests to see whether the button is pressed
Returns:
boolean -True if pressed, false otherwise
Example
if (right_button.is_pressed()) { console.log("right_button is pressed") }