From 31b8eb6ec899104abc1a28e0ae7302731db113dd Mon Sep 17 00:00:00 2001 From: Michal Szafranski Date: Fri, 15 Nov 2019 19:46:26 +0100 Subject: [PATCH 01/67] fixed mac readout --- src/lpf2hub.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index c58e2c6..c38d9af 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -280,7 +280,7 @@ export class LPF2Hub extends Hub { // primary MAC Address } else if (data[3] === 0x0d) { - this._primaryMACAddress = LPF2Hub.decodeMACAddress(data.slice(4, 10)); + this._primaryMACAddress = LPF2Hub.decodeMACAddress(data.slice(5)); // Battery level reports } else if (data[3] === 0x06) { From abd21a88b25e126ecc19ca336d85e1eae277ace6 Mon Sep 17 00:00:00 2001 From: Leo Bonnargent Date: Mon, 18 Nov 2019 09:14:32 +0100 Subject: [PATCH 02/67] Add doc to hub's disconnect event --- src/hub.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hub.ts b/src/hub.ts index 684fd5c..d96af8e 100644 --- a/src/hub.ts +++ b/src/hub.ts @@ -41,6 +41,10 @@ export class Hub extends EventEmitter { this.autoSubscribe = !!autoSubscribe; this._bleDevice = device; device.on("disconnect", () => { + /** + * Emits when the hub is disconnected. + * @event Hub#disconnect + */ this.emit("disconnect"); }); } From 55bcafa637b86a009c883b2c9bd0bb4788efdf38 Mon Sep 17 00:00:00 2001 From: Leo Bonnargent Date: Wed, 20 Nov 2019 14:42:23 +0100 Subject: [PATCH 03/67] Emit attach event any case --- src/hub.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hub.ts b/src/hub.ts index 684fd5c..9418b80 100644 --- a/src/hub.ts +++ b/src/hub.ts @@ -269,14 +269,14 @@ export class Hub extends EventEmitter { port.type = type; if (this.autoSubscribe) { this._activatePortDevice(port.value, type, this._getModeForDeviceType(type), 0x00); - /** - * Emits when a motor or sensor is attached to the Hub. - * @event Hub#attach - * @param {string} port - * @param {DeviceType} type - */ - this.emit("attach", port.id, type); } + /** + * Emits when a motor or sensor is attached to the Hub. + * @event Hub#attach + * @param {string} port + * @param {DeviceType} type + */ + this.emit("attach", port.id, type); } else { port.type = Consts.DeviceType.UNKNOWN; debug(`Port ${port.id} disconnected`); From 0e121a4f92fe523a0ad2a2a4cc8fc186c2d43983 Mon Sep 17 00:00:00 2001 From: Michal Szafranski Date: Sun, 24 Nov 2019 10:51:30 +0100 Subject: [PATCH 04/67] Control+ hub improvements --- src/consts.ts | 7 +++++-- src/controlplushub.ts | 5 ++++- src/lpf2hub.ts | 25 ++++++++++++++++++++----- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/consts.ts b/src/consts.ts index 4a853e0..dac8b22 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -71,10 +71,13 @@ export enum DeviceType { DUPLO_TRAIN_BASE_SPEEDOMETER = 44, CONTROL_PLUS_LARGE_MOTOR = 46, CONTROL_PLUS_XLARGE_MOTOR = 47, + CONTROL_PLUS_GEST = 54, POWERED_UP_REMOTE_BUTTON = 55, RSSI = 56, - CONTROL_PLUS_ACCELEROMETER = 58, - CONTROL_PLUS_TILT = 59 + CONTROL_PLUS_ACCELEROMETER = 57, + CONTROL_PLUS_GYRO = 58, + CONTROL_PLUS_TILT = 59, + TEMPERATURE = 60, } diff --git a/src/controlplushub.ts b/src/controlplushub.ts index 03298e9..fbea784 100644 --- a/src/controlplushub.ts +++ b/src/controlplushub.ts @@ -31,8 +31,10 @@ export class ControlPlusHub extends LPF2Hub { } protected _currentPort = 0x3b; + protected _currentMaxMA = 4175; protected _voltagePort = 0x3c; protected _voltageMaxRaw = 4095; + protected _voltageMaxV = 9.615; constructor (device: IBLEDevice, autoSubscribe: boolean = true) { super(device, autoSubscribe); @@ -42,7 +44,8 @@ export class ControlPlusHub extends LPF2Hub { "B": new Port("B", 1), "C": new Port("C", 2), "D": new Port("D", 3), - "ACCEL": new Port("ACCEL", 98), + "ACCEL": new Port("ACCEL", 97), + "GYRO": new Port("GYRO", 98), "TILT": new Port("TILT", 99) }; this.on("attach", (port, type) => { diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index c58e2c6..176d9fc 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -548,12 +548,27 @@ export class LPF2Hub extends Hub { this.emit("tilt", "TILT", this._lastTiltX, this._lastTiltY, this._lastTiltZ); break; } - case Consts.DeviceType.CONTROL_PLUS_ACCELEROMETER: { - const accelX = Math.round((data.readInt16LE(4) / 28571) * 2000); - const accelY = Math.round((data.readInt16LE(6) / 28571) * 2000); - const accelZ = Math.round((data.readInt16LE(8) / 28571) * 2000); + case Consts.DeviceType.CONTROL_PLUS_GYRO: { + const gyroX = Math.round(data.readInt16LE(4) * 7 / 400); + const gyroY = Math.round(data.readInt16LE(6) * 7 / 400); + const gyroZ = Math.round(data.readInt16LE(8) * 7 / 400); /** - * Emits when accelerometer detects movement. Measured in DPS - degrees per second. + * Emits when gyroscope detects movement. Measured in DPS - degrees per second. + * @event LPF2Hub#gyro + * @param {string} port + * @param {number} x + * @param {number} y + * @param {number} z + */ + this.emit("gyro", "GYRO", gyroX, gyroY, gyroZ); + break; + } + case Consts.DeviceType.CONTROL_PLUS_ACCELEROMETER: { + const accelX = Math.round(data.readInt16LE(4) / 4.096); + const accelY = Math.round(data.readInt16LE(6) / 4.096); + const accelZ = Math.round(data.readInt16LE(8) / 4.096); + /** + * Emits when accelerometer detects movement. Measured in mG. * @event LPF2Hub#accel * @param {string} port * @param {number} x From eb6b20adbb5d3d6e46ccab95ddde2bc817d6809d Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Tue, 3 Dec 2019 23:13:27 -0800 Subject: [PATCH 05/67] Version 5.0.0 --- docs/BoostMoveHub.html | 369 +++++- docs/ControlPlusHub.html | 383 ++++++- docs/DuploTrainBase.html | 369 +++++- docs/Hub.html | 130 ++- docs/LPF2Hub.html | 355 +++++- docs/PUPHub.html | 369 +++++- docs/PUPRemote.html | 369 +++++- docs/PoweredUP.html | 4 +- docs/WeDo2SmartHub.html | 139 ++- docs/boostmovehub.js.html | 4 +- docs/classes.list.html | 2169 ++++++++++++++++++++++++++++++++++- docs/consts.js.html | 9 +- docs/controlplushub.js.html | 9 +- docs/duplotrainbase.js.html | 4 +- docs/global.html | 16 +- docs/hub.js.html | 22 +- docs/index.html | 4 +- docs/lpf2hub.js.html | 31 +- docs/poweredup-node.js.html | 4 +- docs/puphub.js.html | 4 +- docs/pupremote.js.html | 4 +- docs/quicksearch.html | 2 +- docs/wedo2smarthub.js.html | 4 +- package-lock.json | 23 +- package.json | 2 +- 25 files changed, 4504 insertions(+), 294 deletions(-) diff --git a/docs/BoostMoveHub.html b/docs/BoostMoveHub.html index 0e3c54a..739b94c 100644 --- a/docs/BoostMoveHub.html +++ b/docs/BoostMoveHub.html @@ -40,7 +40,7 @@ @@ -327,7 +327,7 @@ @@ -460,7 +460,7 @@ @@ -593,7 +593,7 @@ @@ -726,7 +726,7 @@ @@ -859,7 +859,7 @@ @@ -992,7 +992,7 @@ @@ -1125,7 +1125,7 @@ @@ -1258,7 +1258,7 @@ @@ -1391,7 +1391,7 @@ @@ -1649,7 +1649,7 @@ @@ -1775,7 +1775,7 @@ @@ -1901,7 +1901,7 @@ @@ -2073,7 +2073,7 @@ @@ -4317,7 +4317,7 @@ @@ -4537,7 +4537,7 @@ @@ -4713,7 +4713,7 @@ @@ -4890,7 +4890,7 @@ @@ -4963,7 +4963,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -5141,7 +5141,7 @@ @@ -5317,7 +5317,7 @@ @@ -6006,7 +6006,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6204,6 +6306,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -6519,7 +6840,7 @@ @@ -6988,7 +7309,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/ControlPlusHub.html b/docs/ControlPlusHub.html index e9847ee..0c2287e 100644 --- a/docs/ControlPlusHub.html +++ b/docs/ControlPlusHub.html @@ -40,7 +40,7 @@ @@ -327,7 +327,7 @@ @@ -460,7 +460,7 @@ @@ -593,7 +593,7 @@ @@ -726,7 +726,7 @@ @@ -859,7 +859,7 @@ @@ -992,7 +992,7 @@ @@ -1125,7 +1125,7 @@ @@ -1258,7 +1258,7 @@ @@ -1391,7 +1391,7 @@ @@ -1523,7 +1523,7 @@ @@ -1649,7 +1649,7 @@ @@ -1775,7 +1775,7 @@ @@ -1901,7 +1901,7 @@ @@ -2073,7 +2073,7 @@ @@ -2303,7 +2303,7 @@ @@ -2465,7 +2465,7 @@ @@ -2722,7 +2722,7 @@ @@ -3350,7 +3350,7 @@ @@ -3607,7 +3607,7 @@ @@ -3848,7 +3848,7 @@ @@ -4317,7 +4317,7 @@ @@ -4537,7 +4537,7 @@ @@ -4713,7 +4713,7 @@ @@ -4890,7 +4890,7 @@ @@ -4963,7 +4963,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -5141,7 +5141,7 @@ @@ -5317,7 +5317,7 @@ @@ -6006,7 +6006,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6204,6 +6306,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -6519,7 +6840,7 @@ @@ -6988,7 +7309,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html index 0a9860c..b5f2e06 100644 --- a/docs/DuploTrainBase.html +++ b/docs/DuploTrainBase.html @@ -40,7 +40,7 @@ @@ -327,7 +327,7 @@ @@ -460,7 +460,7 @@ @@ -593,7 +593,7 @@ @@ -726,7 +726,7 @@ @@ -859,7 +859,7 @@ @@ -992,7 +992,7 @@ @@ -1125,7 +1125,7 @@ @@ -1258,7 +1258,7 @@ @@ -1391,7 +1391,7 @@ @@ -1649,7 +1649,7 @@ @@ -1775,7 +1775,7 @@ @@ -1901,7 +1901,7 @@ @@ -2073,7 +2073,7 @@ @@ -3565,7 +3565,7 @@ @@ -3785,7 +3785,7 @@ @@ -3961,7 +3961,7 @@ @@ -4138,7 +4138,7 @@ @@ -4211,7 +4211,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -4389,7 +4389,7 @@ @@ -4565,7 +4565,7 @@ @@ -5254,7 +5254,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -5452,6 +5554,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -5767,7 +6088,7 @@ @@ -6236,7 +6557,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/Hub.html b/docs/Hub.html index 06dfa3c..4326aed 100644 --- a/docs/Hub.html +++ b/docs/Hub.html @@ -40,7 +40,7 @@ @@ -307,7 +307,7 @@ @@ -426,7 +426,7 @@ @@ -545,7 +545,7 @@ @@ -664,7 +664,7 @@ @@ -783,7 +783,7 @@ @@ -902,7 +902,7 @@ @@ -1021,7 +1021,7 @@ @@ -1140,7 +1140,7 @@ @@ -1259,7 +1259,7 @@ @@ -1341,7 +1341,7 @@ @@ -1453,7 +1453,7 @@ @@ -1565,7 +1565,7 @@ @@ -1723,7 +1723,7 @@ @@ -1882,7 +1882,7 @@ @@ -2088,7 +2088,7 @@ @@ -2250,7 +2250,7 @@ @@ -2413,7 +2413,7 @@ @@ -2607,7 +2607,7 @@ @@ -2745,7 +2745,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2824,7 +2912,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html index dfcf835..4a95752 100644 --- a/docs/LPF2Hub.html +++ b/docs/LPF2Hub.html @@ -40,7 +40,7 @@ @@ -316,7 +316,7 @@
@@ -444,7 +444,7 @@ @@ -572,7 +572,7 @@ @@ -700,7 +700,7 @@ @@ -828,7 +828,7 @@ @@ -956,7 +956,7 @@ @@ -1084,7 +1084,7 @@ @@ -1212,7 +1212,7 @@ @@ -1340,7 +1340,7 @@ @@ -1436,7 +1436,7 @@ @@ -1557,7 +1557,7 @@ @@ -1678,7 +1678,7 @@ @@ -1845,7 +1845,7 @@ @@ -2659,7 +2659,7 @@ @@ -2874,7 +2874,7 @@ @@ -3045,7 +3045,7 @@ @@ -3217,7 +3217,7 @@ @@ -3290,7 +3290,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -3459,7 +3459,7 @@ @@ -3630,7 +3630,7 @@ @@ -4287,7 +4287,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -4476,6 +4573,216 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -4773,7 +5080,7 @@ @@ -5224,7 +5531,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/PUPHub.html b/docs/PUPHub.html index bda0f11..fa01e54 100644 --- a/docs/PUPHub.html +++ b/docs/PUPHub.html @@ -40,7 +40,7 @@ @@ -327,7 +327,7 @@ @@ -460,7 +460,7 @@ @@ -593,7 +593,7 @@ @@ -726,7 +726,7 @@ @@ -859,7 +859,7 @@ @@ -992,7 +992,7 @@ @@ -1125,7 +1125,7 @@ @@ -1258,7 +1258,7 @@ @@ -1391,7 +1391,7 @@ @@ -1649,7 +1649,7 @@ @@ -1775,7 +1775,7 @@ @@ -1901,7 +1901,7 @@ @@ -2073,7 +2073,7 @@ @@ -4317,7 +4317,7 @@ @@ -4537,7 +4537,7 @@ @@ -4713,7 +4713,7 @@ @@ -4890,7 +4890,7 @@ @@ -4963,7 +4963,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -5141,7 +5141,7 @@ @@ -5317,7 +5317,7 @@ @@ -6006,7 +6006,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6204,6 +6306,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -6519,7 +6840,7 @@ @@ -6988,7 +7309,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/PUPRemote.html b/docs/PUPRemote.html index 071196f..06ab35c 100644 --- a/docs/PUPRemote.html +++ b/docs/PUPRemote.html @@ -40,7 +40,7 @@ @@ -327,7 +327,7 @@ @@ -460,7 +460,7 @@ @@ -593,7 +593,7 @@ @@ -726,7 +726,7 @@ @@ -859,7 +859,7 @@ @@ -992,7 +992,7 @@ @@ -1125,7 +1125,7 @@ @@ -1258,7 +1258,7 @@ @@ -1391,7 +1391,7 @@ @@ -1487,7 +1487,7 @@ @@ -1613,7 +1613,7 @@ @@ -1739,7 +1739,7 @@ @@ -1911,7 +1911,7 @@ @@ -2766,7 +2766,7 @@ @@ -2986,7 +2986,7 @@ @@ -3162,7 +3162,7 @@ @@ -3339,7 +3339,7 @@ @@ -3412,7 +3412,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -3590,7 +3590,7 @@ @@ -3766,7 +3766,7 @@ @@ -4455,7 +4455,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -4653,6 +4755,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -4968,7 +5289,7 @@ @@ -5437,7 +5758,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/PoweredUP.html b/docs/PoweredUP.html index 47290cc..03923a7 100644 --- a/docs/PoweredUP.html +++ b/docs/PoweredUP.html @@ -40,7 +40,7 @@ @@ -1179,7 +1179,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html index 71a97c6..2b9db75 100644 --- a/docs/WeDo2SmartHub.html +++ b/docs/WeDo2SmartHub.html @@ -40,7 +40,7 @@ @@ -320,7 +320,7 @@ @@ -448,7 +448,7 @@ @@ -576,7 +576,7 @@ @@ -704,7 +704,7 @@ @@ -832,7 +832,7 @@ @@ -960,7 +960,7 @@ @@ -1088,7 +1088,7 @@ @@ -1216,7 +1216,7 @@ @@ -1344,7 +1344,7 @@ @@ -1602,7 +1602,7 @@ @@ -1723,7 +1723,7 @@ @@ -1844,7 +1844,7 @@ @@ -2011,7 +2011,7 @@ @@ -3721,7 +3721,7 @@ @@ -3936,7 +3936,7 @@ @@ -4107,7 +4107,7 @@ @@ -4279,7 +4279,7 @@ @@ -4482,7 +4482,7 @@ @@ -4953,7 +4953,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -5542,7 +5639,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/boostmovehub.js.html b/docs/boostmovehub.js.html index 74a382c..85bb247 100644 --- a/docs/boostmovehub.js.html +++ b/docs/boostmovehub.js.html @@ -40,7 +40,7 @@ @@ -423,7 +423,7 @@ exports.BoostMoveHub = BoostMoveHub; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index 8465b00..6d0338f 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -40,7 +40,7 @@ @@ -203,7 +203,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -381,7 +381,7 @@
@@ -557,7 +557,7 @@ @@ -1246,7 +1246,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1444,6 +1546,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -1759,7 +2080,7 @@ @@ -2190,7 +2511,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -2368,7 +2689,7 @@ @@ -2544,7 +2865,7 @@ @@ -3233,7 +3554,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -3431,6 +3854,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -3746,7 +4388,7 @@ @@ -4177,7 +4819,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -4355,7 +4997,7 @@ @@ -4531,7 +5173,7 @@ @@ -5220,7 +5862,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -5418,6 +6162,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -5733,7 +6696,7 @@ @@ -6285,7 +7248,7 @@ @@ -6423,7 +7386,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6464,7 +7515,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -6633,7 +7684,7 @@
@@ -6804,7 +7855,7 @@ @@ -7461,7 +8512,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -7650,6 +8798,216 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -7947,7 +9305,7 @@ @@ -8513,7 +9871,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -8691,7 +10049,7 @@ @@ -8867,7 +10225,7 @@ @@ -9556,7 +10914,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -9754,6 +11214,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -10069,7 +11748,7 @@ @@ -10500,7 +12179,7 @@
-

Emits when accelerometer detects movement. Measured in DPS - degrees per second.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -10678,7 +12357,7 @@ @@ -10854,7 +12533,7 @@ @@ -11543,7 +13222,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -11741,6 +13522,225 @@ +
+ + + +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + +
@@ -12056,7 +14056,7 @@ @@ -12617,7 +14617,7 @@ @@ -13088,7 +15088,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -13677,7 +15774,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/consts.js.html b/docs/consts.js.html index 5b95611..15c52b7 100644 --- a/docs/consts.js.html +++ b/docs/consts.js.html @@ -40,7 +40,7 @@ @@ -157,10 +157,13 @@ var DeviceType; DeviceType[DeviceType["DUPLO_TRAIN_BASE_SPEEDOMETER"] = 44] = "DUPLO_TRAIN_BASE_SPEEDOMETER"; DeviceType[DeviceType["CONTROL_PLUS_LARGE_MOTOR"] = 46] = "CONTROL_PLUS_LARGE_MOTOR"; DeviceType[DeviceType["CONTROL_PLUS_XLARGE_MOTOR"] = 47] = "CONTROL_PLUS_XLARGE_MOTOR"; + DeviceType[DeviceType["CONTROL_PLUS_GEST"] = 54] = "CONTROL_PLUS_GEST"; DeviceType[DeviceType["POWERED_UP_REMOTE_BUTTON"] = 55] = "POWERED_UP_REMOTE_BUTTON"; DeviceType[DeviceType["RSSI"] = 56] = "RSSI"; - DeviceType[DeviceType["CONTROL_PLUS_ACCELEROMETER"] = 58] = "CONTROL_PLUS_ACCELEROMETER"; + DeviceType[DeviceType["CONTROL_PLUS_ACCELEROMETER"] = 57] = "CONTROL_PLUS_ACCELEROMETER"; + DeviceType[DeviceType["CONTROL_PLUS_GYRO"] = 58] = "CONTROL_PLUS_GYRO"; DeviceType[DeviceType["CONTROL_PLUS_TILT"] = 59] = "CONTROL_PLUS_TILT"; + DeviceType[DeviceType["TEMPERATURE"] = 60] = "TEMPERATURE"; })(DeviceType = exports.DeviceType || (exports.DeviceType = {})); // tslint:disable-next-line exports.DeviceTypeNames = DeviceType; @@ -307,7 +310,7 @@ var BLECharacteristic; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/controlplushub.js.html b/docs/controlplushub.js.html index ab3961e..3d31560 100644 --- a/docs/controlplushub.js.html +++ b/docs/controlplushub.js.html @@ -40,7 +40,7 @@ @@ -108,15 +108,18 @@ class ControlPlusHub extends lpf2hub_1.LPF2Hub { constructor(device, autoSubscribe = true) { super(device, autoSubscribe); this._currentPort = 0x3b; + this._currentMaxMA = 4175; this._voltagePort = 0x3c; this._voltageMaxRaw = 4095; + this._voltageMaxV = 9.615; this.type = Consts.HubType.CONTROL_PLUS_HUB; this._ports = { "A": new port_1.Port("A", 0), "B": new port_1.Port("B", 1), "C": new port_1.Port("C", 2), "D": new port_1.Port("D", 3), - "ACCEL": new port_1.Port("ACCEL", 98), + "ACCEL": new port_1.Port("ACCEL", 97), + "GYRO": new port_1.Port("GYRO", 98), "TILT": new port_1.Port("TILT", 99) }; this.on("attach", (port, type) => { @@ -414,7 +417,7 @@ exports.ControlPlusHub = ControlPlusHub; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/duplotrainbase.js.html b/docs/duplotrainbase.js.html index 45a3553..a5a8eea 100644 --- a/docs/duplotrainbase.js.html +++ b/docs/duplotrainbase.js.html @@ -40,7 +40,7 @@ @@ -262,7 +262,7 @@ exports.DuploTrainBase = DuploTrainBase; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/global.html b/docs/global.html index 87b9672..be0995b 100644 --- a/docs/global.html +++ b/docs/global.html @@ -40,7 +40,7 @@ @@ -356,7 +356,7 @@
@@ -571,7 +571,7 @@ @@ -954,7 +954,7 @@ @@ -1337,7 +1337,7 @@ @@ -2894,7 +2894,7 @@ @@ -3109,7 +3109,7 @@ @@ -3704,7 +3704,7 @@ Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/hub.js.html b/docs/hub.js.html index 3f5f9ef..8d0fa15 100644 --- a/docs/hub.js.html +++ b/docs/hub.js.html @@ -40,7 +40,7 @@ @@ -122,6 +122,10 @@ class Hub extends events_1.EventEmitter { this.autoSubscribe = !!autoSubscribe; this._bleDevice = device; device.on("disconnect", () => { + /** + * Emits when the hub is disconnected. + * @event Hub#disconnect + */ this.emit("disconnect"); }); } @@ -315,14 +319,14 @@ class Hub extends events_1.EventEmitter { port.type = type; if (this.autoSubscribe) { this._activatePortDevice(port.value, type, this._getModeForDeviceType(type), 0x00); - /** - * Emits when a motor or sensor is attached to the Hub. - * @event Hub#attach - * @param {string} port - * @param {DeviceType} type - */ - this.emit("attach", port.id, type); } + /** + * Emits when a motor or sensor is attached to the Hub. + * @event Hub#attach + * @param {string} port + * @param {DeviceType} type + */ + this.emit("attach", port.id, type); } else { port.type = Consts.DeviceType.UNKNOWN; @@ -477,7 +481,7 @@ exports.Hub = Hub; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/index.html b/docs/index.html index a3c6c91..8df7b00 100644 --- a/docs/index.html +++ b/docs/index.html @@ -40,7 +40,7 @@ @@ -360,7 +360,7 @@ console.log("Scanning for Hubs..."); Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/lpf2hub.js.html b/docs/lpf2hub.js.html index cd18f54..866aef4 100644 --- a/docs/lpf2hub.js.html +++ b/docs/lpf2hub.js.html @@ -40,7 +40,7 @@ @@ -332,7 +332,7 @@ class LPF2Hub extends hub_1.Hub { // primary MAC Address } else if (data[3] === 0x0d) { - this._primaryMACAddress = LPF2Hub.decodeMACAddress(data.slice(4, 10)); + this._primaryMACAddress = LPF2Hub.decodeMACAddress(data.slice(5)); // Battery level reports } else if (data[3] === 0x06) { @@ -571,12 +571,27 @@ class LPF2Hub extends hub_1.Hub { this.emit("tilt", "TILT", this._lastTiltX, this._lastTiltY, this._lastTiltZ); break; } - case Consts.DeviceType.CONTROL_PLUS_ACCELEROMETER: { - const accelX = Math.round((data.readInt16LE(4) / 28571) * 2000); - const accelY = Math.round((data.readInt16LE(6) / 28571) * 2000); - const accelZ = Math.round((data.readInt16LE(8) / 28571) * 2000); + case Consts.DeviceType.CONTROL_PLUS_GYRO: { + const gyroX = Math.round(data.readInt16LE(4) * 7 / 400); + const gyroY = Math.round(data.readInt16LE(6) * 7 / 400); + const gyroZ = Math.round(data.readInt16LE(8) * 7 / 400); /** - * Emits when accelerometer detects movement. Measured in DPS - degrees per second. + * Emits when gyroscope detects movement. Measured in DPS - degrees per second. + * @event LPF2Hub#gyro + * @param {string} port + * @param {number} x + * @param {number} y + * @param {number} z + */ + this.emit("gyro", "GYRO", gyroX, gyroY, gyroZ); + break; + } + case Consts.DeviceType.CONTROL_PLUS_ACCELEROMETER: { + const accelX = Math.round(data.readInt16LE(4) / 4.096); + const accelY = Math.round(data.readInt16LE(6) / 4.096); + const accelZ = Math.round(data.readInt16LE(8) / 4.096); + /** + * Emits when accelerometer detects movement. Measured in mG. * @event LPF2Hub#accel * @param {string} port * @param {number} x @@ -682,7 +697,7 @@ exports.LPF2Hub = LPF2Hub; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/poweredup-node.js.html b/docs/poweredup-node.js.html index 9a30885..0bfb7ae 100644 --- a/docs/poweredup-node.js.html +++ b/docs/poweredup-node.js.html @@ -40,7 +40,7 @@ @@ -282,7 +282,7 @@ exports.PoweredUP = PoweredUP; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/puphub.js.html b/docs/puphub.js.html index 65cb01a..3219250 100644 --- a/docs/puphub.js.html +++ b/docs/puphub.js.html @@ -40,7 +40,7 @@ @@ -417,7 +417,7 @@ exports.PUPHub = PUPHub; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/pupremote.js.html b/docs/pupremote.js.html index 65499c0..c7e9543 100644 --- a/docs/pupremote.js.html +++ b/docs/pupremote.js.html @@ -40,7 +40,7 @@ @@ -181,7 +181,7 @@ exports.PUPRemote = PUPRemote; Documentation generated by JSDoc 3.6.3 - on Wed Nov 13th 2019 + on Tue Dec 3rd 2019 using the DocStrap template. diff --git a/docs/quicksearch.html b/docs/quicksearch.html index a8ae974..1d14541 100644 --- a/docs/quicksearch.html +++ b/docs/quicksearch.html @@ -7,7 +7,7 @@ - + + - - - - - -

Vernie / PlayStation DualShock 4 Remote Control

- -
-Current Color:
 
-
- - - \ No newline at end of file diff --git a/examples/winter_village_train.js b/examples/winter_village_train.js deleted file mode 100644 index 7e27f40..0000000 --- a/examples/winter_village_train.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * This runs the train under our Christmas tree. It uses the 10254 Winter Holiday Train retrofitted with a Powered UP hub and train motor. - * It also uses a WeDo 2.0 hub with Powered UP distance sensor to detect the train approaching the station and slow it down. - * - * Note that if you want to use this yourself you don't need to use a WeDo 2.0 hub, you can use any hub that can accept a distance or color/distance sensor. - * - * The maximum speed of the train is set to a constant 50. A further improvement can be made by scaling the speed up according to the current battery voltage, - * so the speed doesn't slow as the battery starts dying. - * - */ - -const PoweredUP = require(".."); - -const poweredUP = new PoweredUP.PoweredUP(); -poweredUP.scan(); // Start scanning for hubs - -console.log("Looking for Hubs..."); - -let train = null; -let sensor = null; - -let ramping = false; - -poweredUP.on("discover", async (hub) => { // Wait to discover hubs - - if (hub.name === "NK_Winter_Train") { - await hub.connect(); // Connect to hub - console.log(`Connected to train!`); - train = hub; - } else if (hub.name === "NK_Winter_Sensor") { - await hub.connect(); // Connect to hub - console.log(`Connected to sensor!`); - sensor = hub; - - sensor.on("distance", (_, distance) => { - if (distance < 5 && !ramping) { - await stopTrain(); - } - }); - - } - - if (train && sensor) { - console.log("Train and sensor connected, starting!"); - await startTrain(); - } - -}); - -const startTrain = async () => { - ramping = true; - await train.rampMotorSpeed("A", 0, 50, 2000); - ramping = false; -} - -const stopTrain = async () => { - ramping = true; - await train.rampMotorSpeed("A", 50, 0, 2000); -} \ No newline at end of file From c0009f8f08d8a81c94520e66a65a71c0f044dad3 Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Fri, 7 Feb 2020 14:28:32 -0800 Subject: [PATCH 65/67] Updated vernie sample, added braking style --- README.md | 15 +- docs/BaseHub.html | 1419 ++ docs/DuploTrainBase.html | 4872 +----- docs/Hub.html | 1791 ++- docs/LPF2Hub.html | 3897 +---- docs/MoveHub.html | 2412 +++ docs/PoweredUP.html | 206 +- docs/RemoteControl.html | 2412 +++ docs/TechnicMediumHub.html | 2412 +++ docs/WeDo2SmartHub.html | 4365 +---- docs/classes.list.html | 13164 +++------------- docs/consts.js.html | 105 +- docs/devices_absolutemotor.js.html | 296 + docs/devices_basicmotor.js.html | 285 + docs/devices_colordistancesensor.js.html | 295 + docs/devices_currentsensor.js.html | 275 + .../devices_duplotrainbasecolorsensor.js.html | 256 + docs/devices_duplotrainbasespeaker.js.html | 250 + .../devices_duplotrainbasespeedometer.js.html | 254 + docs/devices_hubled.js.html | 281 + docs/devices_light.js.html | 267 + docs/devices_motionsensor.js.html | 258 + docs/devices_movehubtiltsensor.js.html | 256 + docs/devices_piezobuzzer.js.html | 249 + docs/devices_remotecontrolbutton.js.html | 260 + docs/devices_tachomotor.js.html | 336 + docs/devices_techniccolorsensor.js.html | 278 + docs/devices_technicdistancesensor.js.html | 277 + docs/devices_technicforcesensor.js.html | 276 + ...echnicmediumhubaccelerometersensor.js.html | 259 + ...devices_technicmediumhubgyrosensor.js.html | 258 + ...devices_technicmediumhubtiltsensor.js.html | 258 + docs/devices_tiltsensor.js.html | 256 + docs/devices_voltagesensor.js.html | 279 + docs/global.html | 480 +- docs/hubs_basehub.js.html | 543 + docs/hubs_duplotrainbase.js.html | 263 + docs/hubs_hub.js.html | 275 + docs/hubs_lpf2hub.js.html | 552 + docs/hubs_movehub.js.html | 277 + docs/hubs_remotecontrol.js.html | 265 + docs/hubs_technicmediumhub.js.html | 271 + docs/hubs_wedo2smarthub.js.html | 417 + docs/index.html | 28 +- docs/poweredup-node.js.html | 84 +- docs/quicksearch.html | 2 +- examples/vernie_remote.js | 52 +- package.json | 8 +- src/consts.ts | 11 + src/devices/absolutemotor.ts | 114 +- src/devices/basicmotor.ts | 2 +- src/devices/tachomotor.ts | 20 +- src/hubs/technicmediumhub.ts | 59 - 53 files changed, 22479 insertions(+), 24273 deletions(-) create mode 100644 docs/BaseHub.html create mode 100644 docs/MoveHub.html create mode 100644 docs/RemoteControl.html create mode 100644 docs/TechnicMediumHub.html create mode 100644 docs/devices_absolutemotor.js.html create mode 100644 docs/devices_basicmotor.js.html create mode 100644 docs/devices_colordistancesensor.js.html create mode 100644 docs/devices_currentsensor.js.html create mode 100644 docs/devices_duplotrainbasecolorsensor.js.html create mode 100644 docs/devices_duplotrainbasespeaker.js.html create mode 100644 docs/devices_duplotrainbasespeedometer.js.html create mode 100644 docs/devices_hubled.js.html create mode 100644 docs/devices_light.js.html create mode 100644 docs/devices_motionsensor.js.html create mode 100644 docs/devices_movehubtiltsensor.js.html create mode 100644 docs/devices_piezobuzzer.js.html create mode 100644 docs/devices_remotecontrolbutton.js.html create mode 100644 docs/devices_tachomotor.js.html create mode 100644 docs/devices_techniccolorsensor.js.html create mode 100644 docs/devices_technicdistancesensor.js.html create mode 100644 docs/devices_technicforcesensor.js.html create mode 100644 docs/devices_technicmediumhubaccelerometersensor.js.html create mode 100644 docs/devices_technicmediumhubgyrosensor.js.html create mode 100644 docs/devices_technicmediumhubtiltsensor.js.html create mode 100644 docs/devices_tiltsensor.js.html create mode 100644 docs/devices_voltagesensor.js.html create mode 100644 docs/hubs_basehub.js.html create mode 100644 docs/hubs_duplotrainbase.js.html create mode 100644 docs/hubs_hub.js.html create mode 100644 docs/hubs_lpf2hub.js.html create mode 100644 docs/hubs_movehub.js.html create mode 100644 docs/hubs_remotecontrol.js.html create mode 100644 docs/hubs_technicmediumhub.js.html create mode 100644 docs/hubs_wedo2smarthub.js.html diff --git a/README.md b/README.md index dbb1771..2c86c9a 100644 --- a/README.md +++ b/README.md @@ -69,17 +69,22 @@ const poweredUP = new PoweredUP.PoweredUP(); poweredUP.on("discover", async (hub) => { // Wait to discover a Hub console.log(`Discovered ${hub.name}!`); await hub.connect(); // Connect to the Hub + const motorA = hub.waitForDeviceAtPort("A"); // Make sure a motor is plugged into port A + const motorB = hub.waitForDeviceAtPort("B"); // Make sure a motor is plugged into port B console.log("Connected"); - await hub.sleep(3000); // Sleep for 3 seconds before starting while (true) { // Repeat indefinitely console.log("Running motor B at speed 75"); - hub.setMotorSpeed("B", 75); // Start a motor attached to port B to run a 3/4 speed (75) indefinitely + motorB.setPower("B", 75); // Start a motor attached to port B to run a 3/4 speed (75) indefinitely console.log("Running motor A at speed 100 for 2 seconds"); - await hub.setMotorSpeed("A", 100, 2000); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop + motorA.setPower("A", 100); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop + await hub.sleep(2000); + motorA.setPower("A", 0); await hub.sleep(1000); // Do nothing for 1 second - console.log("Running motor A at speed -50 for 1 seconds"); - await hub.setMotorSpeed("A", -50, 1000); // Run a motor attached to port A for 1 second at 1/2 speed in reverse (-50) then stop + console.log("Running motor A at speed -50 for 1 second"); + motorA.setPower("A", -50); // Run a motor attached to port A for 1 second at 1/2 speed in reverse (-50) then stop + hub.sleep(1000); + motorA.setPower("A", 0); await hub.sleep(1000); // Do nothing for 1 second } }); diff --git a/docs/BaseHub.html b/docs/BaseHub.html new file mode 100644 index 0000000..b582d8f --- /dev/null +++ b/docs/BaseHub.html @@ -0,0 +1,1419 @@ + + + + + + + node-poweredup Class: BaseHub + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: BaseHub

+
+ +
+ +

+ BaseHub +

+ + +
+ + +
+
+ + +
+
+

new BaseHub()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + +
    +
  • EventEmitter
  • +
+ + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> batteryLevel

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
batteryLevel + + +number + + + + +

Battery level of the hub (Percentage between 0-100)

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> firmwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Firmware version of the hub

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hardwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Hardware version of the hub

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> name

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

Name of the hub

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> primaryMACAddress

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
primaryMACAddress + + +string + + + + +

Primary MAC address of the hub

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> rssi

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rssi + + +number + + + + +

Signal strength of the hub

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> uuid

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uuid + + +string + + + + +

UUID of the hub

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html index b5f2e06..48883ed 100644 --- a/docs/DuploTrainBase.html +++ b/docs/DuploTrainBase.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -194,7 +187,7 @@ @@ -290,17 +283,12 @@
- -
Overrides:
-
@@ -326,141 +314,8 @@
-
- - - - - - - - - - - - - - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -556,17 +411,12 @@
- -
Overrides:
-
@@ -592,8 +442,8 @@
@@ -689,17 +539,12 @@
- -
Overrides:
-
@@ -725,8 +570,8 @@
@@ -822,17 +667,12 @@
- -
Overrides:
-
@@ -858,8 +698,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -955,17 +923,12 @@
- -
Overrides:
-
@@ -991,8 +954,8 @@
@@ -1088,17 +1051,12 @@
- -
Overrides:
-
@@ -1124,8 +1082,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1221,17 +1307,12 @@
- -
Overrides:
-
@@ -1257,141 +1338,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1416,1741 +1364,6 @@
-
-
-

brakeMotor(port)

- - -
-
- - -
-

Fully (hard) stop the motor on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

connect()

- - -
-
- - -
-

Connect to the Hub.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful connect.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

disconnect()

- - -
-
- - -
-

Disconnect the Hub.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful disconnect.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

getHubType()

- - -
-
- - -
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - -
- - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeviceType - - - -
-
- - - - - -
- - - -
-
-

playSound(sound)

- - -
-
- - -
-

Play a built-in train sound.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
sound - - -DuploTrainBaseSound - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
fromSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time - - -number - - - - -

How long the ramp should last (in milliseconds).

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLEDColor(color)

- - -
-
- - -
-

Set the color of the LED on the Hub via a color value.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
speed - - -number -| - -Array.<number> - - - - - - - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

time - - -number - - - - - - - <optional>
- - - - - -

How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the motor is finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - -

setName(name)

@@ -3266,8 +1479,8 @@
@@ -3387,8 +1600,8 @@
@@ -3439,756 +1652,6 @@ -
- - - -
-
-

sleep(delay)

- - -
-
- - -
-

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
delay - - -number - - - - -

How long to sleep (in milliseconds).

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved after the delay is finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

wait(commands)

- - -
-
- - -
-

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
commands - - -Array.<Promise.<any>> - - - - -

Array of executing commands.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved after the commands are finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -4388,184 +1851,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -4671,7 +1958,7 @@ -ButtonState +ButtonState @@ -4735,1531 +2022,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -6333,30 +2097,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -6404,30 +2144,6 @@ - - - - z - - - - - -number - - - - - - - - - - -

(Only available when using a Control+ Hub)

- - - @@ -6477,8 +2193,8 @@
@@ -6557,7 +2273,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/Hub.html b/docs/Hub.html index 4326aed..1999914 100644 --- a/docs/Hub.html +++ b/docs/Hub.html @@ -33,21 +33,14 @@ - - @@ -105,6 +98,10 @@
+
+

The Hub is emitted if the discovered device is a Hub.

+
+ @@ -148,8 +145,8 @@
@@ -188,7 +185,9 @@ @@ -280,126 +279,16 @@ - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
+
Inherited From:
+
- - - - - -
- - - -
- - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - - @@ -425,8 +314,8 @@
@@ -518,6 +407,15 @@ +
Inherited From:
+
+ +
+ @@ -544,8 +442,8 @@
@@ -637,6 +535,15 @@ +
Inherited From:
+
+ +
+ @@ -663,8 +570,8 @@
@@ -756,6 +663,15 @@ +
Inherited From:
+
+ +
+ @@ -782,8 +698,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -875,6 +919,15 @@ +
Inherited From:
+
+ +
+ @@ -901,8 +954,8 @@
@@ -994,6 +1047,15 @@ +
Inherited From:
+
+ +
+ @@ -1020,8 +1082,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1113,126 +1303,16 @@ - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
+
Inherited From:
+
- - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - - @@ -1258,8 +1338,8 @@
@@ -1340,8 +1420,8 @@
@@ -1452,8 +1532,8 @@
@@ -1510,7 +1590,7 @@
-

getHubType()

+

setName(name)

@@ -1518,115 +1598,7 @@
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - -
- - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Set the name of the Hub.

@@ -1661,7 +1633,7 @@ - port + name @@ -1678,7 +1650,7 @@ - +

New name of the hub (14 characters or less, ASCII only).

@@ -1696,6 +1668,15 @@ +
Inherited From:
+
+ +
+ @@ -1722,8 +1703,8 @@
@@ -1751,6 +1732,10 @@
Returns:
+
+

Resolved upon successful issuance of command.

+
+
@@ -1759,7 +1744,128 @@
-DeviceType +Promise + + + +
+
+ + + + + + + + + +
+
+

shutdown()

+ + +
+
+ + +
+

Shutdown the Hub.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful disconnect.

+
+ + + +
+
+ Type +
+
+ +Promise @@ -1881,8 +1987,8 @@
@@ -1933,374 +2039,6 @@ -
- - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -2412,8 +2150,8 @@
@@ -2478,7 +2216,7 @@
-

attach

+

accel

@@ -2486,7 +2224,7 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Emits when accelerometer detects movement. Measured in mG.

@@ -2545,13 +2283,61 @@ - type + x -DeviceType +number + + + + + + + + + + + + + + + + + + y + + + + + +number + + + + + + + + + + + + + + + + + + z + + + + + +number @@ -2580,6 +2366,15 @@ +
Inherited From:
+
+ +
+ @@ -2606,8 +2401,8 @@
@@ -2640,7 +2435,7 @@
-

detach

+

attach

@@ -2648,7 +2443,7 @@
-

Emits when an attached motor or sensor is detached from the Hub.

+

Emits when a device is attached to the Hub.

@@ -2683,13 +2478,13 @@ - port + device -string +Device @@ -2744,8 +2539,317 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2832,8 +2936,179 @@
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2912,7 +3187,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html index 4a95752..9a8d0b4 100644 --- a/docs/LPF2Hub.html +++ b/docs/LPF2Hub.html @@ -33,21 +33,14 @@ - - @@ -148,8 +141,8 @@
@@ -188,7 +181,7 @@ @@ -284,7 +277,7 @@
@@ -315,136 +308,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -540,7 +405,7 @@
@@ -571,8 +436,8 @@
@@ -668,7 +533,7 @@
@@ -699,8 +564,8 @@
@@ -796,7 +661,7 @@
@@ -827,8 +692,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -924,7 +917,7 @@
@@ -955,8 +948,8 @@
@@ -1052,7 +1045,7 @@
@@ -1083,8 +1076,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1180,7 +1301,7 @@
@@ -1211,136 +1332,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1365,909 +1358,6 @@
-
-
-

connect()

- - -
-
- - -
-

Connect to the Hub.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful connect.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

disconnect()

- - -
-
- - -
-

Disconnect the Hub.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful disconnect.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

getHubType()

- - -
-
- - -
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - -
- - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeviceType - - - -
-
- - - - - -
- - - -
-
-

setLEDColor(color)

- - -
-
- - -
-

Set the color of the LED on the Hub via a color value.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
color - - -Color - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - -

setName(name)

@@ -2374,8 +1464,8 @@
@@ -2486,8 +1576,8 @@
@@ -2538,736 +1628,6 @@ -
- - - -
-
-

sleep(delay)

- - -
-
- - -
-

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
delay - - -number - - - - -

How long to sleep (in milliseconds).

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved after the delay is finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

wait(commands)

- - -
-
- - -
-

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
commands - - -Array.<Promise.<any>> - - - - -

Array of executing commands.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved after the commands are finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -3458,179 +1818,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -3736,7 +1925,7 @@ -ButtonState +ButtonState @@ -3791,1458 +1980,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5316,30 +2055,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -5387,30 +2102,6 @@ - - - - z - - - - - -number - - - - - - - - - - -

(Only available when using a Control+ Hub)

- - - @@ -5451,8 +2142,8 @@
@@ -5531,7 +2222,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/MoveHub.html b/docs/MoveHub.html new file mode 100644 index 0000000..1dc1a1f --- /dev/null +++ b/docs/MoveHub.html @@ -0,0 +1,2412 @@ + + + + + + + node-poweredup Class: MoveHub + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MoveHub

+
+ +
+ +

+ MoveHub +

+ + +
+ + +
+
+ + +
+
+

new MoveHub()

+ + +
+
+ + +
+

The MoveHub is emitted if the discovered device is a Move Hub.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> batteryLevel

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
batteryLevel + + +number + + + + +

Battery level of the hub (Percentage between 0-100)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> firmwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Firmware version of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hardwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Hardware version of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> name

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

Name of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> primaryMACAddress

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
primaryMACAddress + + +string + + + + +

Primary MAC address of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> rssi

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rssi + + +number + + + + +

Signal strength of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> uuid

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uuid + + +string + + + + +

UUID of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

setName(name)

+ + +
+
+ + +
+

Set the name of the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

New name of the hub (14 characters or less, ASCII only).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

shutdown()

+ + +
+
+ + +
+

Shutdown the Hub.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful disconnect.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

accel

+ + +
+
+ + +
+

Emits when accelerometer detects movement. Measured in mG.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/PoweredUP.html b/docs/PoweredUP.html index 03923a7..d9f67de 100644 --- a/docs/PoweredUP.html +++ b/docs/PoweredUP.html @@ -33,14 +33,14 @@ @@ -211,7 +211,7 @@
-

getConnectedHubByPrimaryMACAddress(address)

+

getHubByPrimaryMACAddress(address)

@@ -316,7 +316,7 @@
@@ -352,7 +352,7 @@
-Hub +BaseHub @@ -369,7 +369,7 @@
-

getConnectedHubByUUID(uuid)

+

getHubByUUID(uuid)

@@ -474,7 +474,7 @@ @@ -510,7 +510,7 @@
-Hub +BaseHub | null @@ -530,7 +530,7 @@
-

getConnectedHubs()

+

getHubs()

@@ -585,7 +585,7 @@ @@ -621,7 +621,7 @@
-Array.<Hub> +Array.<BaseHub> @@ -638,7 +638,7 @@
-

getConnectedHubsByName(name)

+

getHubsByName(name)

@@ -743,7 +743,7 @@ @@ -779,7 +779,165 @@
-Array.<Hub> +Array.<BaseHub> + + + +
+ + + + + + + + + + +
+
+

getHubsByType(name)

+ + +
+
+ + +
+

Retrieve a list of Powered UP Hub by type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<BaseHub> @@ -851,7 +1009,7 @@
@@ -939,7 +1097,7 @@
@@ -1029,22 +1187,22 @@ -WeDo2SmartHub +WeDo2SmartHub | -BoostMoveHub +MoveHub | -ControlPlusHub +TechnicMediumHub | -PUPHub +Hub | -PUPRemote +RemoteControl | -DuploTrainBase +DuploTrainBase @@ -1100,7 +1258,7 @@ @@ -1179,7 +1337,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/RemoteControl.html b/docs/RemoteControl.html new file mode 100644 index 0000000..21f65a4 --- /dev/null +++ b/docs/RemoteControl.html @@ -0,0 +1,2412 @@ + + + + + + + node-poweredup Class: RemoteControl + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: RemoteControl

+
+ +
+ +

+ RemoteControl +

+ + +
+ + +
+
+ + +
+
+

new RemoteControl()

+ + +
+
+ + +
+

The RemoteControl is emitted if the discovered device is a Remote Control.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> batteryLevel

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
batteryLevel + + +number + + + + +

Battery level of the hub (Percentage between 0-100)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> firmwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Firmware version of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hardwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Hardware version of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> name

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

Name of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> primaryMACAddress

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
primaryMACAddress + + +string + + + + +

Primary MAC address of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> rssi

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rssi + + +number + + + + +

Signal strength of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> uuid

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uuid + + +string + + + + +

UUID of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

setName(name)

+ + +
+
+ + +
+

Set the name of the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

New name of the hub (14 characters or less, ASCII only).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

shutdown()

+ + +
+
+ + +
+

Shutdown the Hub.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful disconnect.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

accel

+ + +
+
+ + +
+

Emits when accelerometer detects movement. Measured in mG.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHub.html b/docs/TechnicMediumHub.html new file mode 100644 index 0000000..9c221df --- /dev/null +++ b/docs/TechnicMediumHub.html @@ -0,0 +1,2412 @@ + + + + + + + node-poweredup Class: TechnicMediumHub + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHub

+
+ +
+ +

+ TechnicMediumHub +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHub()

+ + +
+
+ + +
+

The TechnicMediumHub is emitted if the discovered device is a Technic Medium Hub.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> batteryLevel

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
batteryLevel + + +number + + + + +

Battery level of the hub (Percentage between 0-100)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> firmwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Firmware version of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hardwareVersion

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firmwareVersion + + +string + + + + +

Hardware version of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> name

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

Name of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> primaryMACAddress

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
primaryMACAddress + + +string + + + + +

Primary MAC address of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> rssi

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rssi + + +number + + + + +

Signal strength of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> uuid

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uuid + + +string + + + + +

UUID of the hub

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

setName(name)

+ + +
+
+ + +
+

Set the name of the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

New name of the hub (14 characters or less, ASCII only).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

shutdown()

+ + +
+
+ + +
+

Shutdown the Hub.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful disconnect.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

accel

+ + +
+
+ + +
+

Emits when accelerometer detects movement. Measured in mG.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html index 2b9db75..5479d68 100644 --- a/docs/WeDo2SmartHub.html +++ b/docs/WeDo2SmartHub.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -192,7 +185,7 @@ @@ -288,7 +281,7 @@
@@ -319,136 +312,8 @@
-
- - - - - - - - - - - - - - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -544,7 +409,7 @@
@@ -575,8 +440,8 @@
@@ -672,7 +537,7 @@
@@ -703,8 +568,8 @@
@@ -800,7 +665,7 @@
@@ -831,8 +696,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -928,7 +921,7 @@
@@ -959,8 +952,8 @@
@@ -1056,7 +1049,7 @@
@@ -1087,8 +1080,136 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1184,7 +1305,7 @@
@@ -1215,136 +1336,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1369,1967 +1362,6 @@
-
-
-

brakeMotor(port)

- - -
-
- - -
-

Fully (hard) stop the motor on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

connect()

- - -
-
- - -
-

Connect to the Hub.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful connect.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

disconnect()

- - -
-
- - -
-

Disconnect the Hub.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful disconnect.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

getHubType()

- - -
-
- - -
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - -
- - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeviceType - - - -
-
- - - - - -
- - - -
-
-

playTone(frequency, time)

- - -
-
- - -
-

Play a tone on the Hub's in-built buzzer

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
frequency - - -number - - - - -
time - - -number - - - - -

How long the tone should play for (in milliseconds).

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the tone has finished playing).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
fromSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time - - -number - - - - -

How long the ramp should last (in milliseconds).

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLEDColor(color)

- - -
-
- - -
-

Set the color of the LED on the Hub via a color value.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
color - - -Color - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
brightness - - -number - - - - - - - - - - -

Brightness value between 0-100 (0 is off)

time - - -number - - - - - - - <optional>
- - - - - -

How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the light is turned off.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
speed - - -number - - - - - - - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time - - -number - - - - - - - <optional>
- - - - - -

How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the motor is finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - -

setName(name)

@@ -3436,8 +1468,8 @@
@@ -3548,8 +1580,8 @@
@@ -3600,736 +1632,6 @@ -
- - - -
-
-

sleep(delay)

- - -
-
- - -
-

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
delay - - -number - - - - -

How long to sleep (in milliseconds).

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved after the delay is finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

wait(commands)

- - -
-
- - -
-

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
commands - - -Array.<Promise.<any>> - - - - -

Array of executing commands.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved after the commands are finished.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -4342,177 +1644,6 @@
-
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -4588,7 +1719,7 @@ -ButtonState +ButtonState @@ -4643,924 +1774,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5639,7 +1854,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index 6d0338f..5d56af0 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -33,21 +33,14 @@ - - @@ -149,10 +142,7 @@

Classes

-
BoostMoveHub
-
- -
ControlPlusHub
+
BaseHub
DuploTrainBase
@@ -164,13 +154,13 @@
LPF2Hub
-
PoweredUP
+
MoveHub
-
PUPHub
+
RemoteControl
-
PUPRemote
+
TechnicMediumHub
WeDo2SmartHub
@@ -195,7 +185,7 @@
-

accel

+

absolute

@@ -203,7 +193,7 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Emits when a the motors absolute position is changed.

@@ -238,79 +228,7 @@ - port - - - - - -string - - - - - - - - - - - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z + absolute @@ -345,15 +263,6 @@ -
Inherited From:
-
- -
- @@ -380,355 +289,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

button

- - -
-
- - -
-

Emits when a button is pressed.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
button - - -string - - - - -
state - - -ButtonState - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -802,30 +364,6 @@ - - - port - - - - - -string - - - - - - - - - - - - - - - color @@ -834,7 +372,7 @@ -Color +Color @@ -863,15 +401,6 @@ -
Inherited From:
-
- -
- @@ -898,8 +427,8 @@
@@ -973,30 +502,6 @@ - - - port - - - - - -string - - - - - - - - - - - - - - - color @@ -1005,7 +510,7 @@ -Color +Color @@ -1058,15 +563,6 @@ -
Inherited From:
-
- -
- @@ -1093,262 +589,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1422,30 +664,6 @@ - - - port - - - - - -string - - - - - - - - - - - - - - - distance @@ -1483,15 +701,6 @@ -
Inherited From:
-
- -
- @@ -1518,8 +727,8 @@
@@ -1552,7 +761,7 @@
-

gyro

+

current

@@ -1560,7 +769,7 @@
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+

Emits when a current change is detected.

@@ -1595,79 +804,7 @@ - port - - - - - -string - - - - - - - - - - - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z + current @@ -1702,15 +839,6 @@ -
Inherited From:
-
- -
- @@ -1737,740 +865,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

(Only available when using a Control+ Hub)

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2688,184 +1084,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2971,7 +1191,7 @@ -ButtonState +ButtonState @@ -3035,1531 +1255,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -4633,30 +1330,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -4704,30 +1377,6 @@ - - - - z - - - - - -number - - - - - - - - - - -

(Only available when using a Control+ Hub)

- - - @@ -4777,8 +1426,284 @@
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

speed

+ + +
+
+ + +
+

Emits on a speed change.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -4996,8 +1921,8 @@
@@ -5038,7 +1963,7 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Emits when a device is attached to the Hub.

@@ -5073,37 +1998,13 @@ - port + device -string - - - - - - - - - - - - - - - - - - type - - - - - -DeviceType +Device @@ -5132,21 +2033,7 @@ -
Inherited From:
-
- -
- - -
Overrides:
-
@@ -5172,8 +2059,146 @@
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -5279,7 +2304,7 @@ -ButtonState +ButtonState @@ -5343,526 +2368,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5923,191 +2430,6 @@ -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- @@ -6134,740 +2456,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -6941,30 +2531,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -7012,30 +2578,6 @@ - - - - z - - - - - -number - - - - - - - - - - -

(Only available when using a Control+ Hub)

- - - @@ -7085,396 +2627,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -7683,179 +2837,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -7961,7 +2944,7 @@ -ButtonState +ButtonState @@ -8016,1458 +2999,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -9541,30 +3074,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -9612,30 +3121,6 @@ - - - - z - - - - - -number - - - - - - - - - - -

(Only available when using a Control+ Hub)

- - - @@ -9676,8 +3161,8 @@
@@ -9710,7 +3195,7 @@
-

discover

+

distance

@@ -9718,7 +3203,7 @@
-

Emits when a Powered UP Hub device is found.

+

Emits when a distance sensor is activated.

@@ -9753,28 +3238,13 @@ - hub + distance -WeDo2SmartHub -| - -BoostMoveHub -| - -ControlPlusHub -| - -PUPHub -| - -PUPRemote -| - -DuploTrainBase +number @@ -9785,7 +3255,7 @@ - +

Distance, in millimeters.

@@ -9829,8 +3299,8 @@
@@ -10048,184 +3518,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -10331,7 +3625,7 @@ -ButtonState +ButtonState @@ -10395,1531 +3689,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -11993,30 +3764,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -12064,30 +3811,6 @@ - - - - z - - - - - -number - - - - - - - - - - -

(Only available when using a Control+ Hub)

- - - @@ -12137,8 +3860,170 @@
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -12356,184 +4241,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

attach

- - -
-
- - -
-

Emits when a motor or sensor is attached to the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
type - - -DeviceType - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -12639,7 +4348,7 @@ -ButtonState +ButtonState @@ -12703,8 +4412,593 @@
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button on the remote is pressed or released.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

from 0 to 100.

+ + +
+
+ + +
+

Emits when the ambient light changes.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ambient + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -12778,30 +5072,6 @@ - - - port - - - - - -string - - - - - - - - - - - - - - - color @@ -12810,7 +5080,7 @@ -Color +Color @@ -12839,15 +5109,6 @@ -
Inherited From:
-
- -
- @@ -12874,8 +5135,8 @@
@@ -12908,7 +5169,7 @@
-

colorAndDistance

+

from 0 to 100.

@@ -12916,7 +5177,7 @@
-

A combined color and distance event, emits when the sensor is activated.

+

Emits when the light reflectivity changes.

@@ -12951,13 +5212,13 @@ - port + reflect -string +number @@ -12972,29 +5233,119 @@ + + - - - color + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+
+

from 40 to 2500mm

+ + +
+
- - - -Color + +
+

Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm).

+
+ + + - - + + +
Parameters:
+ - + + + + + + - + - - + + + + + + + + @@ -13016,7 +5367,7 @@ - + @@ -13034,15 +5385,6 @@ -
Inherited From:
-
- -
- @@ -13069,8 +5411,8 @@
@@ -13103,7 +5445,7 @@
-

detach

+

from 50 to 320mm

@@ -13111,7 +5453,7 @@
-

Emits when an attached motor or sensor is detached from the Hub.

+

Emits when the detected distance changes (Fast sampling covers 50mm to 320mm).

@@ -13146,285 +5488,7 @@ - - - - - - - - - - - - - - -
NameType
Description

Distance, in millimeters.

port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + +
NameTypeDescription
port - - -string - - - - -
distancefastDistance @@ -13441,7 +5505,631 @@ -

Distance, in millimeters.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

touch Touched on/off (boolean).

+ + +
+
+ + +
+

Emits when the sensor is touched.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
touch + + +boolean + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

in newtons (0-10).

+ + +
+
+ + +
+

Emits when force is applied.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
force + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

from 0-3.

+ + +
+
+ + +
+

Emits when the sensor is tapped.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tapped + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

accel

+ + +
+
+ + +
+

Emits when accelerometer detects movement. Measured in mG.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13463,7 +6151,7 @@
@@ -13494,8 +6182,350 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + +
NameTypeDescription
port + + +string + + + + +
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -13569,30 +6599,6 @@ - - - port - - - - - -string - - - - - - - - - - - - - - - x @@ -13678,15 +6684,6 @@ -
Inherited From:
-
- -
- @@ -13713,521 +6710,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -14301,30 +6785,6 @@ - - - port - - - - - -string - - - - - - - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

- - - - x @@ -14392,7 +6852,7 @@ -

(Only available when using a Control+ Hub)

+ @@ -14410,15 +6870,6 @@ -
Inherited From:
-
- -
- @@ -14445,8 +6896,8 @@
@@ -14479,7 +6930,7 @@
-

attach

+

voltage

@@ -14487,7 +6938,7 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Emits when a voltage change is detected.

@@ -14522,37 +6973,13 @@ - port + voltage -string - - - - - - - - - - - - - - - - - - type - - - - - -DeviceType +number @@ -14581,15 +7008,6 @@ -
Inherited From:
-
- -
- @@ -14616,8 +7034,8 @@
@@ -14723,7 +7141,7 @@ -ButtonState +ButtonState @@ -14778,924 +7196,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

detach

- - -
-
- - -
-

Emits when an attached motor or sensor is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

disconnect

- - -
-
- - -
-

Emits when the hub is disconnected.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -15774,7 +7276,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/consts.js.html b/docs/consts.js.html index 15c52b7..05bd8d0 100644 --- a/docs/consts.js.html +++ b/docs/consts.js.html @@ -33,14 +33,14 @@ @@ -90,7 +90,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); * @typedef HubType * @property {number} UNKNOWN 0 * @property {number} WEDO2_SMART_HUB 1 - * @property {number} BOOST_MOVE_HUB 2 + * @property {number} MOVE_HUB 2 * @property {number} POWERED_UP_HUB 3 * @property {number} POWERED_UP_REMOTE 4 * @property {number} DUPLO_TRAIN_HUB 5 @@ -100,18 +100,18 @@ var HubType; (function (HubType) { HubType[HubType["UNKNOWN"] = 0] = "UNKNOWN"; HubType[HubType["WEDO2_SMART_HUB"] = 1] = "WEDO2_SMART_HUB"; - HubType[HubType["BOOST_MOVE_HUB"] = 2] = "BOOST_MOVE_HUB"; - HubType[HubType["POWERED_UP_HUB"] = 3] = "POWERED_UP_HUB"; - HubType[HubType["POWERED_UP_REMOTE"] = 4] = "POWERED_UP_REMOTE"; - HubType[HubType["DUPLO_TRAIN_HUB"] = 5] = "DUPLO_TRAIN_HUB"; - HubType[HubType["CONTROL_PLUS_HUB"] = 6] = "CONTROL_PLUS_HUB"; + HubType[HubType["MOVE_HUB"] = 2] = "MOVE_HUB"; + HubType[HubType["HUB"] = 3] = "HUB"; + HubType[HubType["REMOTE_CONTROL"] = 4] = "REMOTE_CONTROL"; + HubType[HubType["DUPLO_TRAIN_BASE"] = 5] = "DUPLO_TRAIN_BASE"; + HubType[HubType["TECHNIC_MEDIUM_HUB"] = 6] = "TECHNIC_MEDIUM_HUB"; })(HubType = exports.HubType || (exports.HubType = {})); // tslint:disable-next-line exports.HubTypeNames = HubType; /** * @typedef DeviceType * @property {number} UNKNOWN 0 - * @property {number} BASIC_MOTOR 1 + * @property {number} SIMPLE_MEDIUM_LINEAR_MOTOR 1 * @property {number} TRAIN_MOTOR 2 * @property {number} LED_LIGHTS 8 * @property {number} VOLTAGE 20 @@ -120,9 +120,9 @@ exports.HubTypeNames = HubType; * @property {number} RGB_LIGHT 23 * @property {number} WEDO2_TILT 34 * @property {number} WEDO2_DISTANCE 35 - * @property {number} BOOST_DISTANCE 37 - * @property {number} BOOST_TACHO_MOTOR 38 - * @property {number} BOOST_MOVE_HUB_MOTOR 39 + * @property {number} COLOR_DISTANCE_SENSOR 37 + * @property {number} MEDIUM_LINEAR_MOTOR 38 + * @property {number} MOVE_HUB_MEDIUM_LINEAR_MOTOR 39 * @property {number} BOOST_TILT 40 * @property {number} DUPLO_TRAIN_BASE_MOTOR 41 * @property {number} DUPLO_TRAIN_BASE_SPEAKER 42 @@ -138,32 +138,37 @@ exports.HubTypeNames = HubType; var DeviceType; (function (DeviceType) { DeviceType[DeviceType["UNKNOWN"] = 0] = "UNKNOWN"; - DeviceType[DeviceType["BASIC_MOTOR"] = 1] = "BASIC_MOTOR"; + DeviceType[DeviceType["SIMPLE_MEDIUM_LINEAR_MOTOR"] = 1] = "SIMPLE_MEDIUM_LINEAR_MOTOR"; DeviceType[DeviceType["TRAIN_MOTOR"] = 2] = "TRAIN_MOTOR"; - DeviceType[DeviceType["LED_LIGHTS"] = 8] = "LED_LIGHTS"; - DeviceType[DeviceType["VOLTAGE"] = 20] = "VOLTAGE"; - DeviceType[DeviceType["CURRENT"] = 21] = "CURRENT"; - DeviceType[DeviceType["PIEZO_TONE"] = 22] = "PIEZO_TONE"; - DeviceType[DeviceType["RGB_LIGHT"] = 23] = "RGB_LIGHT"; - DeviceType[DeviceType["WEDO2_TILT"] = 34] = "WEDO2_TILT"; - DeviceType[DeviceType["WEDO2_DISTANCE"] = 35] = "WEDO2_DISTANCE"; - DeviceType[DeviceType["BOOST_DISTANCE"] = 37] = "BOOST_DISTANCE"; - DeviceType[DeviceType["BOOST_TACHO_MOTOR"] = 38] = "BOOST_TACHO_MOTOR"; - DeviceType[DeviceType["BOOST_MOVE_HUB_MOTOR"] = 39] = "BOOST_MOVE_HUB_MOTOR"; - DeviceType[DeviceType["BOOST_TILT"] = 40] = "BOOST_TILT"; + DeviceType[DeviceType["LIGHT"] = 8] = "LIGHT"; + DeviceType[DeviceType["VOLTAGE_SENSOR"] = 20] = "VOLTAGE_SENSOR"; + DeviceType[DeviceType["CURRENT_SENSOR"] = 21] = "CURRENT_SENSOR"; + DeviceType[DeviceType["PIEZO_BUZZER"] = 22] = "PIEZO_BUZZER"; + DeviceType[DeviceType["HUB_LED"] = 23] = "HUB_LED"; + DeviceType[DeviceType["TILT_SENSOR"] = 34] = "TILT_SENSOR"; + DeviceType[DeviceType["MOTION_SENSOR"] = 35] = "MOTION_SENSOR"; + DeviceType[DeviceType["COLOR_DISTANCE_SENSOR"] = 37] = "COLOR_DISTANCE_SENSOR"; + DeviceType[DeviceType["MEDIUM_LINEAR_MOTOR"] = 38] = "MEDIUM_LINEAR_MOTOR"; + DeviceType[DeviceType["MOVE_HUB_MEDIUM_LINEAR_MOTOR"] = 39] = "MOVE_HUB_MEDIUM_LINEAR_MOTOR"; + DeviceType[DeviceType["MOVE_HUB_TILT_SENSOR"] = 40] = "MOVE_HUB_TILT_SENSOR"; DeviceType[DeviceType["DUPLO_TRAIN_BASE_MOTOR"] = 41] = "DUPLO_TRAIN_BASE_MOTOR"; DeviceType[DeviceType["DUPLO_TRAIN_BASE_SPEAKER"] = 42] = "DUPLO_TRAIN_BASE_SPEAKER"; - DeviceType[DeviceType["DUPLO_TRAIN_BASE_COLOR"] = 43] = "DUPLO_TRAIN_BASE_COLOR"; + DeviceType[DeviceType["DUPLO_TRAIN_BASE_COLOR_SENSOR"] = 43] = "DUPLO_TRAIN_BASE_COLOR_SENSOR"; DeviceType[DeviceType["DUPLO_TRAIN_BASE_SPEEDOMETER"] = 44] = "DUPLO_TRAIN_BASE_SPEEDOMETER"; - DeviceType[DeviceType["CONTROL_PLUS_LARGE_MOTOR"] = 46] = "CONTROL_PLUS_LARGE_MOTOR"; - DeviceType[DeviceType["CONTROL_PLUS_XLARGE_MOTOR"] = 47] = "CONTROL_PLUS_XLARGE_MOTOR"; - DeviceType[DeviceType["CONTROL_PLUS_GEST"] = 54] = "CONTROL_PLUS_GEST"; - DeviceType[DeviceType["POWERED_UP_REMOTE_BUTTON"] = 55] = "POWERED_UP_REMOTE_BUTTON"; - DeviceType[DeviceType["RSSI"] = 56] = "RSSI"; - DeviceType[DeviceType["CONTROL_PLUS_ACCELEROMETER"] = 57] = "CONTROL_PLUS_ACCELEROMETER"; - DeviceType[DeviceType["CONTROL_PLUS_GYRO"] = 58] = "CONTROL_PLUS_GYRO"; - DeviceType[DeviceType["CONTROL_PLUS_TILT"] = 59] = "CONTROL_PLUS_TILT"; - DeviceType[DeviceType["TEMPERATURE"] = 60] = "TEMPERATURE"; + DeviceType[DeviceType["TECHNIC_LARGE_LINEAR_MOTOR"] = 46] = "TECHNIC_LARGE_LINEAR_MOTOR"; + DeviceType[DeviceType["TECHNIC_XLARGE_LINEAR_MOTOR"] = 47] = "TECHNIC_XLARGE_LINEAR_MOTOR"; + DeviceType[DeviceType["TECHNIC_MEDIUM_ANGULAR_MOTOR"] = 48] = "TECHNIC_MEDIUM_ANGULAR_MOTOR"; + DeviceType[DeviceType["TECHNIC_LARGE_ANGULAR_MOTOR"] = 49] = "TECHNIC_LARGE_ANGULAR_MOTOR"; + DeviceType[DeviceType["TECHNIC_MEDIUM_HUB_GEST_SENSOR"] = 54] = "TECHNIC_MEDIUM_HUB_GEST_SENSOR"; + DeviceType[DeviceType["REMOTE_CONTROL_BUTTON"] = 55] = "REMOTE_CONTROL_BUTTON"; + DeviceType[DeviceType["REMOTE_CONTROL_RSSI"] = 56] = "REMOTE_CONTROL_RSSI"; + DeviceType[DeviceType["TECHNIC_MEDIUM_HUB_ACCELEROMETER"] = 57] = "TECHNIC_MEDIUM_HUB_ACCELEROMETER"; + DeviceType[DeviceType["TECHNIC_MEDIUM_HUB_GYRO_SENSOR"] = 58] = "TECHNIC_MEDIUM_HUB_GYRO_SENSOR"; + DeviceType[DeviceType["TECHNIC_MEDIUM_HUB_TILT_SENSOR"] = 59] = "TECHNIC_MEDIUM_HUB_TILT_SENSOR"; + DeviceType[DeviceType["TECHNIC_MEDIUM_HUB_TEMPERATURE_SENSOR"] = 60] = "TECHNIC_MEDIUM_HUB_TEMPERATURE_SENSOR"; + DeviceType[DeviceType["TECHNIC_COLOR_SENSOR"] = 61] = "TECHNIC_COLOR_SENSOR"; + DeviceType[DeviceType["TECHNIC_DISTANCE_SENSOR"] = 62] = "TECHNIC_DISTANCE_SENSOR"; + DeviceType[DeviceType["TECHNIC_FORCE_SENSOR"] = 63] = "TECHNIC_FORCE_SENSOR"; // Spike Prime })(DeviceType = exports.DeviceType || (exports.DeviceType = {})); // tslint:disable-next-line exports.DeviceTypeNames = DeviceType; @@ -209,12 +214,22 @@ exports.ColorNames = Color; */ var ButtonState; (function (ButtonState) { - ButtonState[ButtonState["PRESSED"] = 0] = "PRESSED"; - ButtonState[ButtonState["RELEASED"] = 1] = "RELEASED"; - ButtonState[ButtonState["UP"] = 2] = "UP"; - ButtonState[ButtonState["DOWN"] = 3] = "DOWN"; - ButtonState[ButtonState["STOP"] = 4] = "STOP"; + ButtonState[ButtonState["PRESSED"] = 2] = "PRESSED"; + ButtonState[ButtonState["RELEASED"] = 0] = "RELEASED"; + ButtonState[ButtonState["UP"] = 1] = "UP"; + ButtonState[ButtonState["DOWN"] = 255] = "DOWN"; + ButtonState[ButtonState["STOP"] = 127] = "STOP"; })(ButtonState = exports.ButtonState || (exports.ButtonState = {})); +/** + * @typedef BrakingStyle + * @property {number} HOLD 127 + * @property {number} BRAKE 128 + */ +var BrakingStyle; +(function (BrakingStyle) { + BrakingStyle[BrakingStyle["HOLD"] = 127] = "HOLD"; + BrakingStyle[BrakingStyle["BRAKE"] = 128] = "BRAKE"; +})(BrakingStyle = exports.BrakingStyle || (exports.BrakingStyle = {})); /** * @typedef DuploTrainBaseSound * @property {number} BRAKE 3 @@ -233,11 +248,11 @@ var DuploTrainBaseSound; })(DuploTrainBaseSound = exports.DuploTrainBaseSound || (exports.DuploTrainBaseSound = {})); var BLEManufacturerData; (function (BLEManufacturerData) { - BLEManufacturerData[BLEManufacturerData["DUPLO_TRAIN_HUB_ID"] = 32] = "DUPLO_TRAIN_HUB_ID"; - BLEManufacturerData[BLEManufacturerData["BOOST_MOVE_HUB_ID"] = 64] = "BOOST_MOVE_HUB_ID"; - BLEManufacturerData[BLEManufacturerData["POWERED_UP_HUB_ID"] = 65] = "POWERED_UP_HUB_ID"; - BLEManufacturerData[BLEManufacturerData["POWERED_UP_REMOTE_ID"] = 66] = "POWERED_UP_REMOTE_ID"; - BLEManufacturerData[BLEManufacturerData["CONTROL_PLUS_LARGE_HUB"] = 128] = "CONTROL_PLUS_LARGE_HUB"; + BLEManufacturerData[BLEManufacturerData["DUPLO_TRAIN_BASE_ID"] = 32] = "DUPLO_TRAIN_BASE_ID"; + BLEManufacturerData[BLEManufacturerData["MOVE_HUB_ID"] = 64] = "MOVE_HUB_ID"; + BLEManufacturerData[BLEManufacturerData["HUB_ID"] = 65] = "HUB_ID"; + BLEManufacturerData[BLEManufacturerData["REMOTE_CONTROL_ID"] = 66] = "REMOTE_CONTROL_ID"; + BLEManufacturerData[BLEManufacturerData["TECHNIC_MEDIUM_HUB"] = 128] = "TECHNIC_MEDIUM_HUB"; })(BLEManufacturerData = exports.BLEManufacturerData || (exports.BLEManufacturerData = {})); var BLEService; (function (BLEService) { @@ -310,7 +325,7 @@ var BLECharacteristic; Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/devices_absolutemotor.js.html b/docs/devices_absolutemotor.js.html new file mode 100644 index 0000000..b326086 --- /dev/null +++ b/docs/devices_absolutemotor.js.html @@ -0,0 +1,296 @@ + + + + + + + node-poweredup Source: devices/absolutemotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/absolutemotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const tachomotor_1 = require("./tachomotor");
+const Consts = __importStar(require("../consts"));
+const utils_1 = require("../utils");
+class AbsoluteMotor extends tachomotor_1.TachoMotor {
+    constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) {
+        super(hub, portId, Object.assign({}, modeMap, exports.ModeMap), type);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.ABSOLUTE:
+                const angle = utils_1.normalizeAngle(message.readInt16LE(this.isWeDo2SmartHub ? 2 : 4));
+                /**
+                 * Emits when a the motors absolute position is changed.
+                 * @event AbsoluteMotor#absolute
+                 * @param {number} absolute
+                 */
+                this.notify("absolute", { angle });
+                break;
+            default:
+                super.receive(message);
+                break;
+        }
+    }
+    /**
+     * Rotate a motor by a given angle.
+     * @method AbsoluteMotor#gotoAngle
+     * @param {number} angle Absolute position the motor should go to (degrees from 0).
+     * @param {number} [speed=100] For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.
+     * @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
+     */
+    gotoAngle(angle, speed = 100) {
+        if (!this.isVirtualPort && angle instanceof Array) {
+            throw new Error("Only virtual ports can accept multiple positions");
+        }
+        if (this.isWeDo2SmartHub) {
+            throw new Error("Absolute positioning is not available on the WeDo 2.0 Smart Hub");
+        }
+        this.cancelEventTimer();
+        return new Promise((resolve) => {
+            this._busy = true;
+            if (speed === undefined || speed === null) {
+                speed = 100;
+            }
+            let message;
+            if (angle instanceof Array) {
+                message = Buffer.from([0x81, this.portId, 0x11, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, utils_1.mapSpeed(speed), 0x64, this._brakeStyle, 0x00]);
+                message.writeInt32LE(utils_1.normalizeAngle(angle[0]), 4);
+                message.writeInt32LE(utils_1.normalizeAngle(angle[1]), 8);
+            }
+            else {
+                message = Buffer.from([0x81, this.portId, 0x11, 0x0d, 0x00, 0x00, 0x00, 0x00, utils_1.mapSpeed(speed), 0x64, this._brakeStyle, 0x00]);
+                message.writeInt32LE(utils_1.normalizeAngle(angle), 4);
+            }
+            this.send(message);
+            this._finished = () => {
+                return resolve();
+            };
+        });
+    }
+}
+exports.AbsoluteMotor = AbsoluteMotor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["ROTATION"] = 2] = "ROTATION";
+    Mode[Mode["ABSOLUTE"] = 3] = "ABSOLUTE";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "rotate": Mode.ROTATION,
+    "absolute": Mode.ABSOLUTE
+};
+//# sourceMappingURL=absolutemotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_basicmotor.js.html b/docs/devices_basicmotor.js.html new file mode 100644 index 0000000..5a8203b --- /dev/null +++ b/docs/devices_basicmotor.js.html @@ -0,0 +1,285 @@ + + + + + + + node-poweredup Source: devices/basicmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/basicmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+const utils_1 = require("../utils");
+class BasicMotor extends device_1.Device {
+    constructor(hub, portId, modeMap, type = Consts.DeviceType.UNKNOWN) {
+        super(hub, portId, modeMap, type);
+    }
+    /**
+     * Set the motor power.
+     * @method BasicMotor#setPower
+     * @param {number} power For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    setPower(power, interrupt = true) {
+        if (interrupt) {
+            this.cancelEventTimer();
+        }
+        return new Promise((resolve) => {
+            this.writeDirect(0x00, Buffer.from([utils_1.mapSpeed(power)]));
+            return resolve();
+        });
+    }
+    /**
+     * Ramp the motor power.
+     * @method BasicMotor#rampPower
+     * @param {number} fromPower For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
+     * @param {number} toPower For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
+     * @param {number} time How long the ramp should last (in milliseconds).
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    rampPower(fromPower, toPower, time) {
+        this.cancelEventTimer();
+        return new Promise((resolve) => {
+            utils_1.calculateRamp(this, fromPower, toPower, time)
+                .on("changePower", (power) => {
+                this.setPower(power, false);
+            })
+                .on("finished", resolve);
+        });
+    }
+    /**
+     * Stop the motor.
+     * @method BasicMotor#stop
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    stop() {
+        this.cancelEventTimer();
+        return this.setPower(0);
+    }
+    /**
+     * Brake the motor.
+     * @method BasicMotor#brake
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    brake() {
+        this.cancelEventTimer();
+        return this.setPower(Consts.BrakingStyle.BRAKE);
+    }
+}
+exports.BasicMotor = BasicMotor;
+//# sourceMappingURL=basicmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_colordistancesensor.js.html b/docs/devices_colordistancesensor.js.html new file mode 100644 index 0000000..ecbb848 --- /dev/null +++ b/docs/devices_colordistancesensor.js.html @@ -0,0 +1,295 @@ + + + + + + + node-poweredup Source: devices/colordistancesensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/colordistancesensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class ColorDistanceSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.COLOR_DISTANCE_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.COLOR:
+                if (message[this.isWeDo2SmartHub ? 2 : 4] <= 10) {
+                    const color = message[this.isWeDo2SmartHub ? 2 : 4];
+                    /**
+                     * Emits when a color sensor is activated.
+                     * @event ColorDistanceSensor#color
+                     * @param {Color} color
+                     */
+                    this.notify("color", { color });
+                }
+                break;
+            case Mode.DISTANCE:
+                if (this.isWeDo2SmartHub) {
+                    break;
+                }
+                if (message[4] <= 10) {
+                    const distance = Math.floor(message[4] * 25.4) - 20;
+                    /**
+                     * Emits when a distance sensor is activated.
+                     * @event ColorDistanceSensor#distance
+                     * @param {number} distance Distance, in millimeters.
+                     */
+                    this.notify("distance", { distance });
+                }
+                break;
+            case Mode.COLOR_AND_DISTANCE:
+                if (this.isWeDo2SmartHub) {
+                    break;
+                }
+                let distance = message[5];
+                const partial = message[7];
+                if (partial > 0) {
+                    distance += 1.0 / partial;
+                }
+                distance = Math.floor(distance * 25.4) - 20;
+                /**
+                 * A combined color and distance event, emits when the sensor is activated.
+                 * @event ColorDistanceSensor#colorAndDistance
+                 * @param {Color} color
+                 * @param {number} distance Distance, in millimeters.
+                 */
+                if (message[4] <= 10) {
+                    const color = message[4];
+                    this.notify("colorAndDistance", { color, distance });
+                }
+                break;
+        }
+    }
+}
+exports.ColorDistanceSensor = ColorDistanceSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["COLOR"] = 0] = "COLOR";
+    Mode[Mode["DISTANCE"] = 1] = "DISTANCE";
+    Mode[Mode["COLOR_AND_DISTANCE"] = 8] = "COLOR_AND_DISTANCE";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "color": Mode.COLOR,
+    "distance": Mode.DISTANCE,
+    "colorAndDistance": Mode.COLOR_AND_DISTANCE
+};
+//# sourceMappingURL=colordistancesensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_currentsensor.js.html b/docs/devices_currentsensor.js.html new file mode 100644 index 0000000..1505e38 --- /dev/null +++ b/docs/devices_currentsensor.js.html @@ -0,0 +1,275 @@ + + + + + + + node-poweredup Source: devices/currentsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/currentsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class CurrentSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.CURRENT_SENSOR);
+    }
+    receive(message) {
+        const mode = this.mode;
+        switch (mode) {
+            case Mode.CURRENT:
+                if (this.isWeDo2SmartHub) {
+                    const current = message.readInt16LE(2) / 1000;
+                    this.notify("current", { current });
+                }
+                else {
+                    let maxCurrentValue = MaxCurrentValue[this.hub.type];
+                    if (maxCurrentValue === undefined) {
+                        maxCurrentValue = MaxCurrentValue[Consts.HubType.UNKNOWN];
+                    }
+                    let maxCurrentRaw = MaxCurrentRaw[this.hub.type];
+                    if (maxCurrentRaw === undefined) {
+                        maxCurrentRaw = MaxCurrentRaw[Consts.HubType.UNKNOWN];
+                    }
+                    const current = message.readUInt16LE(4) * maxCurrentValue / maxCurrentRaw;
+                    /**
+                     * Emits when a current change is detected.
+                     * @event CurrentSensor#current
+                     * @param {number} current
+                     */
+                    this.notify("current", { current });
+                }
+                break;
+        }
+    }
+}
+exports.CurrentSensor = CurrentSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["CURRENT"] = 0] = "CURRENT";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "current": Mode.CURRENT
+};
+const MaxCurrentValue = {
+    [Consts.HubType.UNKNOWN]: 2444,
+    [Consts.HubType.TECHNIC_MEDIUM_HUB]: 4175,
+};
+const MaxCurrentRaw = {
+    [Consts.HubType.UNKNOWN]: 4095,
+};
+//# sourceMappingURL=currentsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasecolorsensor.js.html b/docs/devices_duplotrainbasecolorsensor.js.html new file mode 100644 index 0000000..8a4df3a --- /dev/null +++ b/docs/devices_duplotrainbasecolorsensor.js.html @@ -0,0 +1,256 @@ + + + + + + + node-poweredup Source: devices/duplotrainbasecolorsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/duplotrainbasecolorsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class DuploTrainBaseColorSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.DUPLO_TRAIN_BASE_COLOR_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.COLOR:
+                if (message[4] <= 10) {
+                    const color = message[4];
+                    /**
+                     * Emits when a color sensor is activated.
+                     * @event DuploTrainBaseColorSensor#color
+                     * @param {Color} color
+                     */
+                    this.notify("color", { color });
+                }
+                break;
+        }
+    }
+}
+exports.DuploTrainBaseColorSensor = DuploTrainBaseColorSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["COLOR"] = 0] = "COLOR";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "color": Mode.COLOR
+};
+//# sourceMappingURL=duplotrainbasecolorsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasespeaker.js.html b/docs/devices_duplotrainbasespeaker.js.html new file mode 100644 index 0000000..f7985b8 --- /dev/null +++ b/docs/devices_duplotrainbasespeaker.js.html @@ -0,0 +1,250 @@ + + + + + + + node-poweredup Source: devices/duplotrainbasespeaker.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/duplotrainbasespeaker.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class DuploTrainBaseSpeaker extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.DUPLO_TRAIN_BASE_SPEAKER);
+    }
+    /**
+     * Play a built-in train sound.
+     * @method DuploTrainBaseSpeaker#playSound
+     * @param {DuploTrainBaseSound} sound
+     * @returns {Promise} Resolved upon successful issuance of command.
+     */
+    playSound(sound) {
+        return new Promise((resolve, reject) => {
+            this.subscribe(Mode.SOUND);
+            this.writeDirect(0x01, Buffer.from([sound]));
+            return resolve();
+        });
+    }
+}
+exports.DuploTrainBaseSpeaker = DuploTrainBaseSpeaker;
+var Mode;
+(function (Mode) {
+    Mode[Mode["SOUND"] = 1] = "SOUND";
+})(Mode = exports.Mode || (exports.Mode = {}));
+//# sourceMappingURL=duplotrainbasespeaker.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasespeedometer.js.html b/docs/devices_duplotrainbasespeedometer.js.html new file mode 100644 index 0000000..6be089b --- /dev/null +++ b/docs/devices_duplotrainbasespeedometer.js.html @@ -0,0 +1,254 @@ + + + + + + + node-poweredup Source: devices/duplotrainbasespeedometer.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/duplotrainbasespeedometer.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class DuploTrainBaseSpeedometer extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.DUPLO_TRAIN_BASE_SPEEDOMETER);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.SPEED:
+                const speed = message.readInt16LE(4);
+                /**
+                 * Emits on a speed change.
+                 * @event DuploTrainBaseSpeedometer#speed
+                 * @param {number} speed
+                 */
+                this.notify("speed", { speed });
+                break;
+        }
+    }
+}
+exports.DuploTrainBaseSpeedometer = DuploTrainBaseSpeedometer;
+var Mode;
+(function (Mode) {
+    Mode[Mode["SPEED"] = 0] = "SPEED";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "speed": Mode.SPEED
+};
+//# sourceMappingURL=duplotrainbasespeedometer.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_hubled.js.html b/docs/devices_hubled.js.html new file mode 100644 index 0000000..3340263 --- /dev/null +++ b/docs/devices_hubled.js.html @@ -0,0 +1,281 @@ + + + + + + + node-poweredup Source: devices/hubled.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/hubled.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class HubLED extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.HUB_LED);
+    }
+    /**
+     * Set the color of the LED on the Hub via a color value.
+     * @method HubLED#setColor
+     * @param {Color} color
+     * @returns {Promise} Resolved upon successful issuance of command.
+     */
+    setColor(color) {
+        return new Promise((resolve, reject) => {
+            if (typeof color === "boolean") {
+                color = 0;
+            }
+            if (this.isWeDo2SmartHub) {
+                this.send(Buffer.from([0x06, 0x17, 0x01, 0x01]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE);
+                this.send(Buffer.from([0x06, 0x04, 0x01, color]), Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
+            }
+            else {
+                this.subscribe(Mode.COLOR);
+                this.writeDirect(0x00, Buffer.from([color]));
+            }
+            return resolve();
+        });
+    }
+    /**
+     * Set the color of the LED on the Hub via RGB values.
+     * @method HubLED#setRGB
+     * @param {number} red
+     * @param {number} green
+     * @param {number} blue
+     * @returns {Promise} Resolved upon successful issuance of command.
+     */
+    setRGB(red, green, blue) {
+        return new Promise((resolve, reject) => {
+            if (this.isWeDo2SmartHub) {
+                this.send(Buffer.from([0x06, 0x17, 0x01, 0x02]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE);
+                this.send(Buffer.from([0x06, 0x04, 0x03, red, green, blue]), Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
+            }
+            else {
+                this.subscribe(Mode.RGB);
+                this.writeDirect(0x01, Buffer.from([red, green, blue]));
+            }
+            return resolve();
+        });
+    }
+}
+exports.HubLED = HubLED;
+var Mode;
+(function (Mode) {
+    Mode[Mode["COLOR"] = 0] = "COLOR";
+    Mode[Mode["RGB"] = 1] = "RGB";
+})(Mode = exports.Mode || (exports.Mode = {}));
+//# sourceMappingURL=hubled.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_light.js.html b/docs/devices_light.js.html new file mode 100644 index 0000000..87521bc --- /dev/null +++ b/docs/devices_light.js.html @@ -0,0 +1,267 @@ + + + + + + + node-poweredup Source: devices/light.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/light.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+const utils_1 = require("../utils");
+class Light extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.LIGHT);
+    }
+    /**
+     * Set the light brightness.
+     * @method Light#setBrightness
+     * @param {number} brightness Brightness value between 0-100 (0 is off)
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    setBrightness(brightness, interrupt = true) {
+        if (interrupt) {
+            this.cancelEventTimer();
+        }
+        return new Promise((resolve) => {
+            this.writeDirect(0x00, Buffer.from([brightness]));
+            return resolve();
+        });
+    }
+    /**
+     * Ramp the light brightness.
+     * @method Light#rampBrightness
+     * @param {number} fromBrightness Brightness value between 0-100 (0 is off)
+     * @param {number} toBrightness Brightness value between 0-100 (0 is off)
+     * @param {number} time How long the ramp should last (in milliseconds).
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    rampBrightness(fromBrightness, toBrightness, time) {
+        this.cancelEventTimer();
+        return new Promise((resolve) => {
+            utils_1.calculateRamp(this, fromBrightness, toBrightness, time)
+                .on("changePower", (power) => {
+                this.setBrightness(power, false);
+            })
+                .on("finished", resolve);
+        });
+    }
+}
+exports.Light = Light;
+//# sourceMappingURL=light.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_motionsensor.js.html b/docs/devices_motionsensor.js.html new file mode 100644 index 0000000..c4f16b1 --- /dev/null +++ b/docs/devices_motionsensor.js.html @@ -0,0 +1,258 @@ + + + + + + + node-poweredup Source: devices/motionsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/motionsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class MotionSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.MOTION_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.DISTANCE:
+                let distance = message[this.isWeDo2SmartHub ? 2 : 4];
+                if (message[this.isWeDo2SmartHub ? 3 : 5] === 1) {
+                    distance = distance + 255;
+                }
+                distance *= 10;
+                /**
+                 * Emits when a distance sensor is activated.
+                 * @event MotionSensor#distance
+                 * @param {number} distance Distance, in millimeters.
+                 */
+                this.notify("distance", { distance });
+                break;
+        }
+    }
+}
+exports.MotionSensor = MotionSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["DISTANCE"] = 0] = "DISTANCE";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "distance": Mode.DISTANCE
+};
+//# sourceMappingURL=motionsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_movehubtiltsensor.js.html b/docs/devices_movehubtiltsensor.js.html new file mode 100644 index 0000000..c3bdc7c --- /dev/null +++ b/docs/devices_movehubtiltsensor.js.html @@ -0,0 +1,256 @@ + + + + + + + node-poweredup Source: devices/movehubtiltsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/movehubtiltsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class MoveHubTiltSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.MOVE_HUB_TILT_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.TILT:
+                /**
+                 * Emits when a tilt sensor is activated.
+                 * @event MoveHubTiltSensor#tilt
+                 * @param {number} x
+                 * @param {number} y
+                 */
+                const x = -message.readInt8(4);
+                const y = message.readInt8(5);
+                this.notify("tilt", { x, y });
+                break;
+        }
+    }
+}
+exports.MoveHubTiltSensor = MoveHubTiltSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["TILT"] = 0] = "TILT";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "tilt": Mode.TILT
+};
+//# sourceMappingURL=movehubtiltsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_piezobuzzer.js.html b/docs/devices_piezobuzzer.js.html new file mode 100644 index 0000000..9edb6bd --- /dev/null +++ b/docs/devices_piezobuzzer.js.html @@ -0,0 +1,249 @@ + + + + + + + node-poweredup Source: devices/piezobuzzer.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/piezobuzzer.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class PiezoBuzzer extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.PIEZO_BUZZER);
+    }
+    /**
+     * Play a tone on the Hub's in-built buzzer
+     * @method PiezoBuzzer#playTone
+     * @param {number} frequency
+     * @param {number} time How long the tone should play for (in milliseconds).
+     * @returns {Promise} Resolved upon successful completion of command (ie. once the tone has finished playing).
+     */
+    playTone(frequency, time) {
+        return new Promise((resolve) => {
+            const data = Buffer.from([0x05, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00]);
+            data.writeUInt16LE(frequency, 3);
+            data.writeUInt16LE(time, 5);
+            this.send(data, Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
+            global.setTimeout(resolve, time);
+        });
+    }
+}
+exports.PiezoBuzzer = PiezoBuzzer;
+//# sourceMappingURL=piezobuzzer.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_remotecontrolbutton.js.html b/docs/devices_remotecontrolbutton.js.html new file mode 100644 index 0000000..db27234 --- /dev/null +++ b/docs/devices_remotecontrolbutton.js.html @@ -0,0 +1,260 @@ + + + + + + + node-poweredup Source: devices/remotecontrolbutton.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/remotecontrolbutton.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class RemoteControlButton extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.REMOTE_CONTROL_BUTTON);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.BUTTON_EVENTS:
+                /**
+                 * Emits when a button on the remote is pressed or released.
+                 * @event RemoteControlButton#button
+                 * @param {number} event
+                 */
+                const event = message[4];
+                this.notify("remoteButton", { event });
+                break;
+        }
+    }
+}
+exports.RemoteControlButton = RemoteControlButton;
+var Mode;
+(function (Mode) {
+    Mode[Mode["BUTTON_EVENTS"] = 0] = "BUTTON_EVENTS";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "remoteButton": Mode.BUTTON_EVENTS
+};
+exports.ButtonState = {
+    "UP": 0x01,
+    "DOWN": 0xff,
+    "STOP": 0x7f,
+    "RELEASED": 0x00,
+};
+//# sourceMappingURL=remotecontrolbutton.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_tachomotor.js.html b/docs/devices_tachomotor.js.html new file mode 100644 index 0000000..1e2ce11 --- /dev/null +++ b/docs/devices_tachomotor.js.html @@ -0,0 +1,336 @@ + + + + + + + node-poweredup Source: devices/tachomotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/tachomotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+const utils_1 = require("../utils");
+class TachoMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) {
+        super(hub, portId, Object.assign({}, modeMap, exports.ModeMap), type);
+        this._brakeStyle = Consts.BrakingStyle.BRAKE;
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.ROTATION:
+                const degrees = message.readInt32LE(this.isWeDo2SmartHub ? 2 : 4);
+                /**
+                 * Emits when a rotation sensor is activated.
+                 * @event TachoMotor#rotate
+                 * @param {number} rotation
+                 */
+                this.notify("rotate", { degrees });
+                break;
+        }
+    }
+    setBrakingStyle(style) {
+        this._brakeStyle = style;
+    }
+    /**
+     * Set the motor speed.
+     * @method TachoMotor#setSpeed
+     * @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    setSpeed(speed, time) {
+        if (!this.isVirtualPort && speed instanceof Array) {
+            throw new Error("Only virtual ports can accept multiple speeds");
+        }
+        if (this.isWeDo2SmartHub) {
+            throw new Error("Motor speed is not available on the WeDo 2.0 Smart Hub");
+        }
+        this.cancelEventTimer();
+        return new Promise((resolve) => {
+            this._busy = true;
+            if (speed === undefined || speed === null) {
+                speed = 100;
+            }
+            let message;
+            if (time !== undefined) {
+                if (speed instanceof Array) {
+                    message = Buffer.from([0x81, this.portId, 0x11, 0x0a, 0x00, 0x00, utils_1.mapSpeed(speed[0]), utils_1.mapSpeed(speed[1]), 0x64, this._brakeStyle, 0x00]);
+                }
+                else {
+                    message = Buffer.from([0x81, this.portId, 0x11, 0x09, 0x00, 0x00, utils_1.mapSpeed(speed), 0x64, this._brakeStyle, 0x00]);
+                }
+                message.writeUInt16LE(time, 4);
+            }
+            else {
+                if (speed instanceof Array) {
+                    message = Buffer.from([0x81, this.portId, 0x11, 0x08, utils_1.mapSpeed(speed[0]), utils_1.mapSpeed(speed[1]), 0x64, this._brakeStyle, 0x00]);
+                }
+                else {
+                    message = Buffer.from([0x81, this.portId, 0x11, 0x07, utils_1.mapSpeed(speed), 0x64, 0x03, 0x64, this._brakeStyle, 0x00]);
+                }
+            }
+            this.send(message);
+            this._finished = () => {
+                return resolve();
+            };
+        });
+    }
+    /**
+     * Rotate a motor by a given amount of degrees.
+     * @method TachoMotor#rotateByDegrees
+     * @param {number} degrees How much the motor should be rotated (in degrees).
+     * @param {number} [speed=100] For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.
+     * @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
+     */
+    rotateByDegrees(degrees, speed) {
+        if (!this.isVirtualPort && speed instanceof Array) {
+            throw new Error("Only virtual ports can accept multiple speeds");
+        }
+        if (this.isWeDo2SmartHub) {
+            throw new Error("Rotation is not available on the WeDo 2.0 Smart Hub");
+        }
+        this.cancelEventTimer();
+        return new Promise((resolve) => {
+            this._busy = true;
+            if (speed === undefined || speed === null) {
+                speed = 100;
+            }
+            let message;
+            if (speed instanceof Array) {
+                message = Buffer.from([0x81, this.portId, 0x11, 0x0c, 0x00, 0x00, 0x00, 0x00, utils_1.mapSpeed(speed[0]), utils_1.mapSpeed(speed[1]), 0x64, this._brakeStyle, 0x03]);
+            }
+            else {
+                message = Buffer.from([0x81, this.portId, 0x11, 0x0b, 0x00, 0x00, 0x00, 0x00, utils_1.mapSpeed(speed), 0x64, this._brakeStyle, 0x03]);
+            }
+            message.writeUInt32LE(degrees, 4);
+            this.send(message);
+            this._finished = () => {
+                return resolve();
+            };
+        });
+    }
+}
+exports.TachoMotor = TachoMotor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["ROTATION"] = 2] = "ROTATION";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "rotate": Mode.ROTATION
+};
+//# sourceMappingURL=tachomotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_techniccolorsensor.js.html b/docs/devices_techniccolorsensor.js.html new file mode 100644 index 0000000..104ed63 --- /dev/null +++ b/docs/devices_techniccolorsensor.js.html @@ -0,0 +1,278 @@ + + + + + + + node-poweredup Source: devices/techniccolorsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/techniccolorsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TechnicColorSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_COLOR_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.COLOR:
+                if (message[4] <= 10) {
+                    const color = message[4];
+                    /**
+                     * Emits when a color sensor is activated.
+                     * @event TechnicColorSensor#color
+                     * @param {Color} color
+                     */
+                    this.notify("color", { color });
+                }
+                break;
+            case Mode.REFLECTIVITY:
+                const reflect = message[4];
+                /**
+                 * Emits when the light reflectivity changes.
+                 * @event TechnicColorSensor#reflect Percentage, from 0 to 100.
+                 * @param {number} reflect
+                 */
+                this.notify("reflect", { reflect });
+                break;
+            case Mode.AMBIENT_LIGHT:
+                const ambient = message[4];
+                /**
+                 * Emits when the ambient light changes.
+                 * @event TechnicColorSensor#ambient Percentage, from 0 to 100.
+                 * @param {number} ambient
+                 */
+                this.notify("ambient", { ambient });
+                break;
+        }
+    }
+}
+exports.TechnicColorSensor = TechnicColorSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["COLOR"] = 0] = "COLOR";
+    Mode[Mode["REFLECTIVITY"] = 1] = "REFLECTIVITY";
+    Mode[Mode["AMBIENT_LIGHT"] = 2] = "AMBIENT_LIGHT";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "color": Mode.COLOR,
+    "reflect": Mode.REFLECTIVITY,
+    "ambient": Mode.AMBIENT_LIGHT
+};
+//# sourceMappingURL=techniccolorsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicdistancesensor.js.html b/docs/devices_technicdistancesensor.js.html new file mode 100644 index 0000000..ede059c --- /dev/null +++ b/docs/devices_technicdistancesensor.js.html @@ -0,0 +1,277 @@ + + + + + + + node-poweredup Source: devices/technicdistancesensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicdistancesensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TechnicDistanceSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_DISTANCE_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.DISTANCE:
+                const distance = message.readUInt16LE(4);
+                /**
+                 * Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm).
+                 * @event TechnicDistanceSensor#distance Distance, from 40 to 2500mm
+                 * @param {number} distance
+                 */
+                this.notify("distance", { distance });
+                break;
+            case Mode.FAST_DISTANCE:
+                const fastDistance = message.readUInt16LE(4);
+                /**
+                 * Emits when the detected distance changes (Fast sampling covers 50mm to 320mm).
+                 * @event TechnicDistanceSensor#fastDistance Distance, from 50 to 320mm
+                 * @param {number} fastDistance
+                 */
+                this.notify("fastDistance", { fastDistance });
+                break;
+        }
+    }
+    /**
+     * Set the brightness (or turn on/off) the lights around the eyes.
+     * @method TechnicDistanceSensor#setBrightness
+     * @param {number} topLeft Top left quadrant (above left eye). 0-100 brightness.
+     * @param {number} bottomLeft Bottom left quadrant (below left eye). 0-100 brightness.
+     * @param {number} topRight Top right quadrant (above right eye). 0-100 brightness.
+     * @param {number} bottomRight Bottom right quadrant (below right eye). 0-100 brightness.
+     * @returns {Promise} Resolved upon successful completion of command.
+     */
+    setBrightness(topLeft, bottomLeft, topRight, bottomRight) {
+        this.writeDirect(0x05, Buffer.from([topLeft, topRight, bottomLeft, bottomRight]));
+    }
+}
+exports.TechnicDistanceSensor = TechnicDistanceSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["DISTANCE"] = 0] = "DISTANCE";
+    Mode[Mode["FAST_DISTANCE"] = 1] = "FAST_DISTANCE";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "distance": Mode.DISTANCE,
+    "fastDistance": Mode.FAST_DISTANCE
+};
+//# sourceMappingURL=technicdistancesensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicforcesensor.js.html b/docs/devices_technicforcesensor.js.html new file mode 100644 index 0000000..3d2c10e --- /dev/null +++ b/docs/devices_technicforcesensor.js.html @@ -0,0 +1,276 @@ + + + + + + + node-poweredup Source: devices/technicforcesensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicforcesensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TechnicForceSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_FORCE_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.FORCE:
+                const force = message[4] / 10;
+                /**
+                 * Emits when force is applied.
+                 * @event TechnicForceSensor#force Force, in newtons (0-10).
+                 * @param {number} force
+                 */
+                this.notify("force", { force });
+                break;
+            case Mode.TOUCHED:
+                const touched = message[4] ? true : false;
+                /**
+                 * Emits when the sensor is touched.
+                 * @event TechnicForceSensor#touch Touched on/off (boolean).
+                 * @param {boolean} touch
+                 */
+                this.notify("touched", { touched });
+                break;
+            case Mode.TAPPED:
+                const tapped = message[4];
+                /**
+                 * Emits when the sensor is tapped.
+                 * @event TechnicForceSensor#tapped How hard the sensor was tapped, from 0-3.
+                 * @param {number} tapped
+                 */
+                this.notify("tapped", { tapped });
+                break;
+        }
+    }
+}
+exports.TechnicForceSensor = TechnicForceSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["FORCE"] = 0] = "FORCE";
+    Mode[Mode["TOUCHED"] = 1] = "TOUCHED";
+    Mode[Mode["TAPPED"] = 2] = "TAPPED";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "force": Mode.FORCE,
+    "touched": Mode.TOUCHED,
+    "tapped": Mode.TAPPED
+};
+//# sourceMappingURL=technicforcesensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumhubaccelerometersensor.js.html b/docs/devices_technicmediumhubaccelerometersensor.js.html new file mode 100644 index 0000000..a5b737f --- /dev/null +++ b/docs/devices_technicmediumhubaccelerometersensor.js.html @@ -0,0 +1,259 @@ + + + + + + + node-poweredup Source: devices/technicmediumhubaccelerometersensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicmediumhubaccelerometersensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TechnicMediumHubAccelerometerSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.ACCEL:
+                /**
+                 * Emits when accelerometer detects movement. Measured in mG.
+                 * @event LPF2Hub#accel
+                 * @param {string} port
+                 * @param {number} x
+                 * @param {number} y
+                 * @param {number} z
+                 */
+                const x = Math.round(message.readInt16LE(4) / 4.096);
+                const y = Math.round(message.readInt16LE(6) / 4.096);
+                const z = Math.round(message.readInt16LE(8) / 4.096);
+                this.notify("accel", { x, y, z });
+                break;
+        }
+    }
+}
+exports.TechnicMediumHubAccelerometerSensor = TechnicMediumHubAccelerometerSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["ACCEL"] = 0] = "ACCEL";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "accel": Mode.ACCEL
+};
+//# sourceMappingURL=technicmediumhubaccelerometersensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumhubgyrosensor.js.html b/docs/devices_technicmediumhubgyrosensor.js.html new file mode 100644 index 0000000..b267432 --- /dev/null +++ b/docs/devices_technicmediumhubgyrosensor.js.html @@ -0,0 +1,258 @@ + + + + + + + node-poweredup Source: devices/technicmediumhubgyrosensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicmediumhubgyrosensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TechnicMediumHubGyroSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.GYRO:
+                /**
+                 * Emits when gyroscope detects movement. Measured in DPS - degrees per second.
+                 * @event TechnicMediumHubGyroSensor#gyro
+                 * @param {number} x
+                 * @param {number} y
+                 * @param {number} z
+                 */
+                const x = Math.round(message.readInt16LE(4) * 7 / 400);
+                const y = Math.round(message.readInt16LE(6) * 7 / 400);
+                const z = Math.round(message.readInt16LE(8) * 7 / 400);
+                this.notify("gyro", { x, y, z });
+                break;
+        }
+    }
+}
+exports.TechnicMediumHubGyroSensor = TechnicMediumHubGyroSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["GYRO"] = 0] = "GYRO";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "gyro": Mode.GYRO
+};
+//# sourceMappingURL=technicmediumhubgyrosensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumhubtiltsensor.js.html b/docs/devices_technicmediumhubtiltsensor.js.html new file mode 100644 index 0000000..0453b84 --- /dev/null +++ b/docs/devices_technicmediumhubtiltsensor.js.html @@ -0,0 +1,258 @@ + + + + + + + node-poweredup Source: devices/technicmediumhubtiltsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicmediumhubtiltsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TechnicMediumHubTiltSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_TILT_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.TILT:
+                /**
+                 * Emits when a tilt sensor is activated.
+                 * @event TechnicMediumHubTiltSensor#tilt
+                 * @param {number} x
+                 * @param {number} y
+                 * @param {number} z
+                 */
+                const z = -message.readInt16LE(4);
+                const y = message.readInt16LE(6);
+                const x = message.readInt16LE(8);
+                this.notify("tilt", { x, y, z });
+                break;
+        }
+    }
+}
+exports.TechnicMediumHubTiltSensor = TechnicMediumHubTiltSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["TILT"] = 0] = "TILT";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "tilt": Mode.TILT
+};
+//# sourceMappingURL=technicmediumhubtiltsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_tiltsensor.js.html b/docs/devices_tiltsensor.js.html new file mode 100644 index 0000000..4c09882 --- /dev/null +++ b/docs/devices_tiltsensor.js.html @@ -0,0 +1,256 @@ + + + + + + + node-poweredup Source: devices/tiltsensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/tiltsensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class TiltSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.TILT_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.TILT:
+                const x = message.readInt8(this.isWeDo2SmartHub ? 2 : 4);
+                const y = message.readInt8(this.isWeDo2SmartHub ? 3 : 5);
+                /**
+                 * Emits when a tilt sensor is activated.
+                 * @event LPF2Hub#tilt
+                 * @param {number} x
+                 * @param {number} y
+                 */
+                this.notify("tilt", { x, y });
+                break;
+        }
+    }
+}
+exports.TiltSensor = TiltSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["TILT"] = 0] = "TILT";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "tilt": Mode.TILT
+};
+//# sourceMappingURL=tiltsensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_voltagesensor.js.html b/docs/devices_voltagesensor.js.html new file mode 100644 index 0000000..a341a20 --- /dev/null +++ b/docs/devices_voltagesensor.js.html @@ -0,0 +1,279 @@ + + + + + + + node-poweredup Source: devices/voltagesensor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/voltagesensor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const device_1 = require("./device");
+const Consts = __importStar(require("../consts"));
+class VoltageSensor extends device_1.Device {
+    constructor(hub, portId) {
+        super(hub, portId, exports.ModeMap, Consts.DeviceType.VOLTAGE_SENSOR);
+    }
+    receive(message) {
+        const mode = this._mode;
+        switch (mode) {
+            case Mode.VOLTAGE:
+                if (this.isWeDo2SmartHub) {
+                    const voltage = message.readInt16LE(2) / 40;
+                    this.notify("voltage", { voltage });
+                }
+                else {
+                    let maxVoltageValue = MaxVoltageValue[this.hub.type];
+                    if (maxVoltageValue === undefined) {
+                        maxVoltageValue = MaxVoltageValue[Consts.HubType.UNKNOWN];
+                    }
+                    let maxVoltageRaw = MaxVoltageRaw[this.hub.type];
+                    if (maxVoltageRaw === undefined) {
+                        maxVoltageRaw = MaxVoltageRaw[Consts.HubType.UNKNOWN];
+                    }
+                    const voltage = message.readUInt16LE(4) * maxVoltageValue / maxVoltageRaw;
+                    /**
+                     * Emits when a voltage change is detected.
+                     * @event VoltageSensor#voltage
+                     * @param {number} voltage
+                     */
+                    this.notify("voltage", { voltage });
+                }
+                break;
+        }
+    }
+}
+exports.VoltageSensor = VoltageSensor;
+var Mode;
+(function (Mode) {
+    Mode[Mode["VOLTAGE"] = 0] = "VOLTAGE";
+})(Mode = exports.Mode || (exports.Mode = {}));
+exports.ModeMap = {
+    "voltage": Mode.VOLTAGE
+};
+const MaxVoltageValue = {
+    [Consts.HubType.UNKNOWN]: 9.615,
+    [Consts.HubType.DUPLO_TRAIN_BASE]: 6.4,
+    [Consts.HubType.REMOTE_CONTROL]: 6.4,
+};
+const MaxVoltageRaw = {
+    [Consts.HubType.UNKNOWN]: 3893,
+    [Consts.HubType.DUPLO_TRAIN_BASE]: 3047,
+    [Consts.HubType.REMOTE_CONTROL]: 3200,
+    [Consts.HubType.TECHNIC_MEDIUM_HUB]: 4095,
+};
+//# sourceMappingURL=voltagesensor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/global.html b/docs/global.html index be0995b..2d215b1 100644 --- a/docs/global.html +++ b/docs/global.html @@ -33,14 +33,14 @@ @@ -161,8 +161,8 @@

-
-

ButtonState

+
+

BrakingStyle

@@ -201,7 +201,7 @@ - PRESSED + HOLD @@ -218,14 +218,14 @@ -

0

+

127

- RELEASED + BRAKE @@ -242,79 +242,7 @@ -

1

- - - - - - - UP - - - - - -number - - - - - - - - - - -

2

- - - - - - - DOWN - - - - - -number - - - - - - - - - - -

3

- - - - - - - STOP - - - - - -number - - - - - - - - - - -

4

+

128

@@ -356,7 +284,150 @@ +
+ + + + + + + + + + + + + + + +
+
+

BrakingStyle

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
HOLD + + +number + + + + +

127

BRAKE + + +number + + + + +

128

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -571,7 +642,222 @@ +
+ + + + + + + + + + + + + + + +
+
+

ButtonState

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PRESSED + + +number + + + + +

0

RELEASED + + +number + + + + +

1

UP + + +number + + + + +

2

DOWN + + +number + + + + +

3

STOP + + +number + + + + +

4

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -954,7 +1240,7 @@
@@ -1337,7 +1623,7 @@ @@ -1421,7 +1707,7 @@ - BASIC_MOTOR + SIMPLE_MEDIUM_LINEAR_MOTOR @@ -1637,7 +1923,7 @@ - BOOST_DISTANCE + COLOR_DISTANCE_SENSOR @@ -1661,7 +1947,7 @@ - BOOST_TACHO_MOTOR + MEDIUM_LINEAR_MOTOR @@ -1685,7 +1971,7 @@ - BOOST_MOVE_HUB_MOTOR + MOVE_HUB_MEDIUM_LINEAR_MOTOR @@ -2092,7 +2378,7 @@ - BASIC_MOTOR + SIMPLE_MEDIUM_LINEAR_MOTOR @@ -2308,7 +2594,7 @@ - BOOST_DISTANCE + COLOR_DISTANCE_SENSOR @@ -2332,7 +2618,7 @@ - BOOST_TACHO_MOTOR + MEDIUM_LINEAR_MOTOR @@ -2356,7 +2642,7 @@ - BOOST_MOVE_HUB_MOTOR + MOVE_HUB_MEDIUM_LINEAR_MOTOR @@ -2894,7 +3180,7 @@ @@ -3109,7 +3395,7 @@ @@ -3217,7 +3503,7 @@ - BOOST_MOVE_HUB + MOVE_HUB @@ -3480,7 +3766,7 @@ - BOOST_MOVE_HUB + MOVE_HUB @@ -3704,7 +3990,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/hubs_basehub.js.html b/docs/hubs_basehub.js.html new file mode 100644 index 0000000..af7ab7a --- /dev/null +++ b/docs/hubs_basehub.js.html @@ -0,0 +1,543 @@ + + + + + + + node-poweredup Source: hubs/basehub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/basehub.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const events_1 = require("events");
+const colordistancesensor_1 = require("../devices/colordistancesensor");
+const currentsensor_1 = require("../devices/currentsensor");
+const device_1 = require("../devices/device");
+const duplotrainbasecolorsensor_1 = require("../devices/duplotrainbasecolorsensor");
+const duplotrainbasemotor_1 = require("../devices/duplotrainbasemotor");
+const duplotrainbasespeaker_1 = require("../devices/duplotrainbasespeaker");
+const duplotrainbasespeedometer_1 = require("../devices/duplotrainbasespeedometer");
+const hubled_1 = require("../devices/hubled");
+const light_1 = require("../devices/light");
+const mediumlinearmotor_1 = require("../devices/mediumlinearmotor");
+const motionsensor_1 = require("../devices/motionsensor");
+const movehubmediumlinearmotor_1 = require("../devices/movehubmediumlinearmotor");
+const movehubtiltsensor_1 = require("../devices/movehubtiltsensor");
+const piezobuzzer_1 = require("../devices/piezobuzzer");
+const remotecontrolbutton_1 = require("../devices/remotecontrolbutton");
+const simplemediumlinearmotor_1 = require("../devices/simplemediumlinearmotor");
+const techniccolorsensor_1 = require("../devices/techniccolorsensor");
+const technicdistancesensor_1 = require("../devices/technicdistancesensor");
+const technicforcesensor_1 = require("../devices/technicforcesensor");
+const techniclargeangularmotor_1 = require("../devices/techniclargeangularmotor");
+const techniclargelinearmotor_1 = require("../devices/techniclargelinearmotor");
+const technicmediumangularmotor_1 = require("../devices/technicmediumangularmotor");
+const technicmediumhubaccelerometersensor_1 = require("../devices/technicmediumhubaccelerometersensor");
+const technicmediumhubgyrosensor_1 = require("../devices/technicmediumhubgyrosensor");
+const technicmediumhubtiltsensor_1 = require("../devices/technicmediumhubtiltsensor");
+const technicxlargelinearmotor_1 = require("../devices/technicxlargelinearmotor");
+const tiltsensor_1 = require("../devices/tiltsensor");
+const trainmotor_1 = require("../devices/trainmotor");
+const voltagesensor_1 = require("../devices/voltagesensor");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("basehub");
+/**
+ * @class BaseHub
+ * @extends EventEmitter
+ */
+class BaseHub extends events_1.EventEmitter {
+    constructor(bleDevice, portMap = {}, type = Consts.HubType.UNKNOWN) {
+        super();
+        this._attachedDevices = {};
+        this._name = "";
+        this._firmwareVersion = "0.0.00.0000";
+        this._hardwareVersion = "0.0.00.0000";
+        this._primaryMACAddress = "00:00:00:00:00:00";
+        this._batteryLevel = 100;
+        this._rssi = -60;
+        this._portMap = {};
+        this._virtualPorts = [];
+        this._attachCallbacks = [];
+        this.setMaxListeners(23); // Technic Medium Hub has 9 built in devices + 4 external ports. Node.js throws a warning after 10 attached event listeners.
+        this._type = type;
+        this._bleDevice = bleDevice;
+        this._portMap = Object.assign({}, portMap);
+        bleDevice.on("disconnect", () => {
+            /**
+             * Emits when the hub is disconnected.
+             * @event Hub#disconnect
+             */
+            this.emit("disconnect");
+        });
+    }
+    /**
+     * @readonly
+     * @property {string} name Name of the hub
+     */
+    get name() {
+        return this._bleDevice.name;
+    }
+    /**
+     * @readonly
+     * @property {string} type Hub type
+     */
+    get type() {
+        return this._type;
+    }
+    /**
+     * @readonly
+     * @property {string[]} ports Array of port names
+     */
+    get ports() {
+        return Object.keys(this._portMap);
+    }
+    /**
+     * @readonly
+     * @property {string} firmwareVersion Firmware version of the hub
+     */
+    get firmwareVersion() {
+        return this._firmwareVersion;
+    }
+    /**
+     * @readonly
+     * @property {string} firmwareVersion Hardware version of the hub
+     */
+    get hardwareVersion() {
+        return this._hardwareVersion;
+    }
+    /**
+     * @readonly
+     * @property {string} primaryMACAddress Primary MAC address of the hub
+     */
+    get primaryMACAddress() {
+        return this._primaryMACAddress;
+    }
+    /**
+     * @readonly
+     * @property {string} uuid UUID of the hub
+     */
+    get uuid() {
+        return this._bleDevice.uuid;
+    }
+    /**
+     * @readonly
+     * @property {number} batteryLevel Battery level of the hub (Percentage between 0-100)
+     */
+    get batteryLevel() {
+        return this._batteryLevel;
+    }
+    /**
+     * @readonly
+     * @property {number} rssi Signal strength of the hub
+     */
+    get rssi() {
+        return this._rssi;
+    }
+    /**
+     * Connect to the Hub.
+     * @method Hub#connect
+     * @returns {Promise} Resolved upon successful connect.
+     */
+    connect() {
+        return new Promise(async (connectResolve, connectReject) => {
+            if (this._bleDevice.connecting) {
+                return connectReject("Already connecting");
+            }
+            else if (this._bleDevice.connected) {
+                return connectReject("Already connected");
+            }
+            await this._bleDevice.connect();
+            return connectResolve();
+        });
+    }
+    /**
+     * Disconnect the Hub.
+     * @method Hub#disconnect
+     * @returns {Promise} Resolved upon successful disconnect.
+     */
+    disconnect() {
+        return this._bleDevice.disconnect();
+    }
+    getDeviceAtPort(portName) {
+        const portId = this._portMap[portName];
+        if (portId !== undefined) {
+            return this._attachedDevices[portId];
+        }
+        else {
+            return undefined;
+        }
+    }
+    waitForDeviceAtPort(portName) {
+        return new Promise((resolve) => {
+            const existingDevice = this.getDeviceAtPort(portName);
+            if (existingDevice) {
+                return resolve(existingDevice);
+            }
+            this._attachCallbacks.push((device) => {
+                if (device.portName === portName) {
+                    resolve(device);
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            });
+        });
+    }
+    getDevices() {
+        return Object.values(this._attachedDevices);
+    }
+    getDevicesByType(deviceType) {
+        return this.getDevices().filter((device) => device.type === deviceType);
+    }
+    waitForDeviceByType(deviceType) {
+        return new Promise((resolve) => {
+            const existingDevices = this.getDevicesByType(deviceType);
+            if (existingDevices.length >= 1) {
+                return resolve(existingDevices[0]);
+            }
+            this._attachCallbacks.push((device) => {
+                if (device.type === deviceType) {
+                    resolve(device);
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            });
+        });
+    }
+    getPortNameForPortId(portId) {
+        for (const port of Object.keys(this._portMap)) {
+            if (this._portMap[port] === portId) {
+                return port;
+            }
+        }
+        return;
+    }
+    isPortVirtual(portId) {
+        return (this._virtualPorts.indexOf(portId) > -1);
+    }
+    /**
+     * Sleep a given amount of time.
+     *
+     * This is a helper method to make it easier to add delays into a chain of commands.
+     * @method Hub#sleep
+     * @param {number} delay How long to sleep (in milliseconds).
+     * @returns {Promise} Resolved after the delay is finished.
+     */
+    sleep(delay) {
+        return new Promise((resolve) => {
+            global.setTimeout(resolve, delay);
+        });
+    }
+    /**
+     * Wait until a given list of concurrently running commands are complete.
+     *
+     * This is a helper method to make it easier to wait for concurrent commands to complete.
+     * @method Hub#wait
+     * @param {Array<Promise<any>>} commands Array of executing commands.
+     * @returns {Promise} Resolved after the commands are finished.
+     */
+    wait(commands) {
+        return Promise.all(commands);
+    }
+    send(message, uuid, callback) {
+        if (callback) {
+            callback();
+        }
+    }
+    subscribe(portId, deviceType, mode) {
+        // NK Do nothing here
+    }
+    unsubscribe(portId, deviceType, mode) {
+        // NK Do nothing here
+    }
+    _attachDevice(device) {
+        this._attachedDevices[device.portId] = device;
+        /**
+         * Emits when a device is attached to the Hub.
+         * @event Hub#attach
+         * @param {Device} device
+         */
+        this.emit("attach", device);
+        debug(`Attached device type ${device.type} (${Consts.DeviceTypeNames[device.type]}) on port ${device.portName} (${device.portId})`);
+        let i = this._attachCallbacks.length;
+        while (i--) {
+            const callback = this._attachCallbacks[i];
+            if (callback(device)) {
+                this._attachCallbacks.splice(i, 1);
+            }
+        }
+    }
+    _detachDevice(device) {
+        delete this._attachedDevices[device.portId];
+        /**
+         * Emits when a device is detached from the Hub.
+         * @event Hub#attach
+         * @param {Device} device
+         */
+        this.emit("detach", device);
+        debug(`Detached device type ${device.type} (${Consts.DeviceTypeNames[device.type]}) on port ${device.portName} (${device.portId})`);
+    }
+    _createDevice(deviceType, portId) {
+        let constructor;
+        // NK TODO: This needs to go in a better place
+        const deviceConstructors = {
+            [Consts.DeviceType.LIGHT]: light_1.Light,
+            [Consts.DeviceType.TRAIN_MOTOR]: trainmotor_1.TrainMotor,
+            [Consts.DeviceType.SIMPLE_MEDIUM_LINEAR_MOTOR]: simplemediumlinearmotor_1.SimpleMediumLinearMotor,
+            [Consts.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR]: movehubmediumlinearmotor_1.MoveHubMediumLinearMotor,
+            [Consts.DeviceType.MOTION_SENSOR]: motionsensor_1.MotionSensor,
+            [Consts.DeviceType.TILT_SENSOR]: tiltsensor_1.TiltSensor,
+            [Consts.DeviceType.MOVE_HUB_TILT_SENSOR]: movehubtiltsensor_1.MoveHubTiltSensor,
+            [Consts.DeviceType.PIEZO_BUZZER]: piezobuzzer_1.PiezoBuzzer,
+            [Consts.DeviceType.TECHNIC_COLOR_SENSOR]: techniccolorsensor_1.TechnicColorSensor,
+            [Consts.DeviceType.TECHNIC_DISTANCE_SENSOR]: technicdistancesensor_1.TechnicDistanceSensor,
+            [Consts.DeviceType.TECHNIC_FORCE_SENSOR]: technicforcesensor_1.TechnicForceSensor,
+            [Consts.DeviceType.TECHNIC_MEDIUM_HUB_TILT_SENSOR]: technicmediumhubtiltsensor_1.TechnicMediumHubTiltSensor,
+            [Consts.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR]: technicmediumhubgyrosensor_1.TechnicMediumHubGyroSensor,
+            [Consts.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER]: technicmediumhubaccelerometersensor_1.TechnicMediumHubAccelerometerSensor,
+            [Consts.DeviceType.MEDIUM_LINEAR_MOTOR]: mediumlinearmotor_1.MediumLinearMotor,
+            [Consts.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR]: technicmediumangularmotor_1.TechnicMediumAngularMotor,
+            [Consts.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR]: techniclargeangularmotor_1.TechnicLargeAngularMotor,
+            [Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR]: techniclargelinearmotor_1.TechnicLargeLinearMotor,
+            [Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR]: technicxlargelinearmotor_1.TechnicXLargeLinearMotor,
+            [Consts.DeviceType.COLOR_DISTANCE_SENSOR]: colordistancesensor_1.ColorDistanceSensor,
+            [Consts.DeviceType.VOLTAGE_SENSOR]: voltagesensor_1.VoltageSensor,
+            [Consts.DeviceType.CURRENT_SENSOR]: currentsensor_1.CurrentSensor,
+            [Consts.DeviceType.REMOTE_CONTROL_BUTTON]: remotecontrolbutton_1.RemoteControlButton,
+            [Consts.DeviceType.HUB_LED]: hubled_1.HubLED,
+            [Consts.DeviceType.DUPLO_TRAIN_BASE_COLOR_SENSOR]: duplotrainbasecolorsensor_1.DuploTrainBaseColorSensor,
+            [Consts.DeviceType.DUPLO_TRAIN_BASE_MOTOR]: duplotrainbasemotor_1.DuploTrainBaseMotor,
+            [Consts.DeviceType.DUPLO_TRAIN_BASE_SPEAKER]: duplotrainbasespeaker_1.DuploTrainBaseSpeaker,
+            [Consts.DeviceType.DUPLO_TRAIN_BASE_SPEEDOMETER]: duplotrainbasespeedometer_1.DuploTrainBaseSpeedometer
+        };
+        constructor = deviceConstructors[deviceType];
+        if (constructor) {
+            return new constructor(this, portId);
+        }
+        else {
+            return new device_1.Device(this, portId, undefined, deviceType);
+        }
+    }
+    _getDeviceByPortId(portId) {
+        return this._attachedDevices[portId];
+    }
+}
+exports.BaseHub = BaseHub;
+//# sourceMappingURL=basehub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_duplotrainbase.js.html b/docs/hubs_duplotrainbase.js.html new file mode 100644 index 0000000..7d4c71b --- /dev/null +++ b/docs/hubs_duplotrainbase.js.html @@ -0,0 +1,263 @@ + + + + + + + node-poweredup Source: hubs/duplotrainbase.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/duplotrainbase.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("duplotrainbase");
+/**
+ * The DuploTrainBase is emitted if the discovered device is a Duplo Train Base.
+ * @class DuploTrainBase
+ * @extends LPF2Hub
+ * @extends BaseHub
+ */
+class DuploTrainBase extends lpf2hub_1.LPF2Hub {
+    static IsDuploTrainBase(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.DUPLO_TRAIN_BASE_ID);
+    }
+    constructor(device) {
+        super(device, exports.PortMap, Consts.HubType.DUPLO_TRAIN_BASE);
+        debug("Discovered Duplo Train Base");
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Duplo Train Base");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.DuploTrainBase = DuploTrainBase;
+exports.PortMap = {
+    "MOTOR": 0,
+    "COLOR": 18,
+    "SPEEDOMETER": 19
+};
+//# sourceMappingURL=duplotrainbase.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_hub.js.html b/docs/hubs_hub.js.html new file mode 100644 index 0000000..bf00f19 --- /dev/null +++ b/docs/hubs_hub.js.html @@ -0,0 +1,275 @@ + + + + + + + node-poweredup Source: hubs/hub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/hub.js

+ +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const compare_versions_1 = __importDefault(require("compare-versions"));
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("hub");
+/**
+ * The Hub is emitted if the discovered device is a Hub.
+ * @class Hub
+ * @extends LPF2Hub
+ * @extends BaseHub
+ */
+class Hub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, exports.PortMap, Consts.HubType.HUB);
+        this._currentPort = 0x3b;
+        debug("Discovered Powered UP Hub");
+    }
+    static IsHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.HUB_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Powered UP Hub");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+    _checkFirmware(version) {
+        if (compare_versions_1.default("1.1.00.0004", version) === 1) {
+            throw new Error(`Your Powered Up Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
+        }
+    }
+}
+exports.Hub = Hub;
+exports.PortMap = {
+    "A": 0,
+    "B": 1,
+    "HUB_LED": 50,
+    "CURRENT_SENSOR": 59,
+    "VOLTAGE_SENSOR": 60
+};
+//# sourceMappingURL=hub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_lpf2hub.js.html b/docs/hubs_lpf2hub.js.html new file mode 100644 index 0000000..13d46e8 --- /dev/null +++ b/docs/hubs_lpf2hub.js.html @@ -0,0 +1,552 @@ + + + + + + + node-poweredup Source: hubs/lpf2hub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/lpf2hub.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basehub_1 = require("./basehub");
+const Consts = __importStar(require("../consts"));
+const utils_1 = require("../utils");
+const Debug = require("debug");
+const debug = Debug("lpf2hub");
+const modeInfoDebug = Debug("lpf2hubmodeinfo");
+/**
+ * @class LPF2Hub
+ * @extends BaseHub
+ */
+class LPF2Hub extends basehub_1.BaseHub {
+    constructor() {
+        super(...arguments);
+        this._messageBuffer = Buffer.alloc(0);
+        this._propertyRequestCallbacks = {};
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("LPF2Hub connecting");
+            await super.connect();
+            await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.LPF2_HUB);
+            this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.LPF2_ALL, this._parseMessage.bind(this));
+            await this.sleep(500);
+            this._requestHubPropertyReports(0x02); // Activate button reports
+            await this._requestHubPropertyValue(0x03); // Request firmware version
+            await this._requestHubPropertyValue(0x04); // Request hardware version
+            this._requestHubPropertyReports(0x05); // Activate RSSI updates
+            this._requestHubPropertyReports(0x06); // Activate battery level reports
+            await this._requestHubPropertyValue(0x0d); // Request primary MAC address
+            this.emit("connect");
+            debug("LPF2Hub connected");
+            resolve();
+        });
+    }
+    /**
+     * Shutdown the Hub.
+     * @method LPF2Hub#shutdown
+     * @returns {Promise} Resolved upon successful disconnect.
+     */
+    shutdown() {
+        return new Promise((resolve, reject) => {
+            this.send(Buffer.from([0x02, 0x01]), Consts.BLECharacteristic.LPF2_ALL, () => {
+                return resolve();
+            });
+        });
+    }
+    /**
+     * Set the name of the Hub.
+     * @method LPF2Hub#setName
+     * @param {string} name New name of the hub (14 characters or less, ASCII only).
+     * @returns {Promise} Resolved upon successful issuance of command.
+     */
+    setName(name) {
+        if (name.length > 14) {
+            throw new Error("Name must be 14 characters or less");
+        }
+        return new Promise((resolve, reject) => {
+            let data = Buffer.from([0x01, 0x01, 0x01]);
+            data = Buffer.concat([data, Buffer.from(name, "ascii")]);
+            // Send this twice, as sometimes the first time doesn't take
+            this.send(data, Consts.BLECharacteristic.LPF2_ALL);
+            this.send(data, Consts.BLECharacteristic.LPF2_ALL);
+            this._name = name;
+            return resolve();
+        });
+    }
+    send(message, uuid, callback) {
+        message = Buffer.concat([Buffer.alloc(2), message]);
+        message[0] = message.length;
+        debug("Sent Message (LPF2_ALL)", message);
+        this._bleDevice.writeToCharacteristic(uuid, message, callback);
+    }
+    subscribe(portId, deviceType, mode) {
+        this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
+    }
+    unsubscribe(portId, mode) {
+        this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.LPF2_ALL);
+    }
+    createVirtualPort(firstPortName, secondPortName) {
+        const firstDevice = this.getDeviceAtPort(firstPortName);
+        if (!firstDevice) {
+            throw new Error(`Port ${firstPortName} does not have an attached device`);
+        }
+        const secondDevice = this.getDeviceAtPort(secondPortName);
+        if (!secondDevice) {
+            throw new Error(`Port ${secondPortName} does not have an attached device`);
+        }
+        if (firstDevice.type !== secondDevice.type) {
+            throw new Error(`Both devices must be of the same type to create a virtual port`);
+        }
+        this.send(Buffer.from([0x61, 0x01, firstDevice.portId, secondDevice.portId]), Consts.BLECharacteristic.LPF2_ALL);
+    }
+    _checkFirmware(version) {
+        return;
+    }
+    _parseMessage(data) {
+        if (data) {
+            this._messageBuffer = Buffer.concat([this._messageBuffer, data]);
+        }
+        if (this._messageBuffer.length <= 0) {
+            return;
+        }
+        const len = this._messageBuffer[0];
+        if (len >= this._messageBuffer.length) {
+            const message = this._messageBuffer.slice(0, len);
+            this._messageBuffer = this._messageBuffer.slice(len);
+            debug("Received Message (LPF2_ALL)", message);
+            switch (message[2]) {
+                case 0x01: {
+                    const property = message[3];
+                    const callback = this._propertyRequestCallbacks[property];
+                    if (callback) {
+                        callback(message);
+                    }
+                    else {
+                        this._parseHubPropertyResponse(message);
+                    }
+                    delete this._propertyRequestCallbacks[property];
+                    break;
+                }
+                case 0x04: {
+                    this._parsePortMessage(message);
+                    break;
+                }
+                case 0x43: {
+                    this._parsePortInformationResponse(message);
+                    break;
+                }
+                case 0x44: {
+                    this._parseModeInformationResponse(message);
+                    break;
+                }
+                case 0x45: {
+                    this._parseSensorMessage(message);
+                    break;
+                }
+                case 0x82: {
+                    this._parsePortAction(message);
+                    break;
+                }
+            }
+            if (this._messageBuffer.length > 0) {
+                this._parseMessage();
+            }
+        }
+    }
+    _requestHubPropertyValue(property) {
+        return new Promise((resolve) => {
+            this._propertyRequestCallbacks[property] = (message) => {
+                this._parseHubPropertyResponse(message);
+                return resolve();
+            };
+            this.send(Buffer.from([0x01, property, 0x05]), Consts.BLECharacteristic.LPF2_ALL);
+        });
+    }
+    _requestHubPropertyReports(property) {
+        this.send(Buffer.from([0x01, property, 0x02]), Consts.BLECharacteristic.LPF2_ALL);
+    }
+    _parseHubPropertyResponse(message) {
+        // Button press reports
+        if (message[3] === 0x02) {
+            if (message[5] === 1) {
+                /**
+                 * Emits when a button is pressed.
+                 * @event LPF2Hub#button
+                 * @param {string} button
+                 * @param {ButtonState} state
+                 */
+                this.emit("button", { event: Consts.ButtonState.PRESSED });
+                return;
+            }
+            else if (message[5] === 0) {
+                this.emit("button", { event: Consts.ButtonState.RELEASED });
+                return;
+            }
+            // Firmware version
+        }
+        else if (message[3] === 0x03) {
+            this._firmwareVersion = utils_1.decodeVersion(message.readInt32LE(5));
+            this._checkFirmware(this._firmwareVersion);
+            // Hardware version
+        }
+        else if (message[3] === 0x04) {
+            this._hardwareVersion = utils_1.decodeVersion(message.readInt32LE(5));
+            // RSSI update
+        }
+        else if (message[3] === 0x05) {
+            const rssi = message.readInt8(5);
+            if (rssi !== 0) {
+                this._rssi = rssi;
+                this.emit("rssi", { rssi: this._rssi });
+            }
+            // primary MAC Address
+        }
+        else if (message[3] === 0x0d) {
+            this._primaryMACAddress = utils_1.decodeMACAddress(message.slice(5));
+            // Battery level reports
+        }
+        else if (message[3] === 0x06) {
+            const batteryLevel = message[5];
+            if (batteryLevel !== this._batteryLevel) {
+                this._batteryLevel = batteryLevel;
+                this.emit("batteryLevel", { batteryLevel });
+            }
+        }
+    }
+    _parsePortMessage(message) {
+        const portId = message[3];
+        const event = message[4];
+        const deviceType = event ? message.readUInt16LE(5) : 0;
+        // Handle device attachments
+        if (event === 0x01) {
+            if (modeInfoDebug.enabled) {
+                const deviceTypeName = Consts.DeviceTypeNames[message[5]] || "Unknown";
+                modeInfoDebug(`Port ${utils_1.toHex(portId)}, type ${utils_1.toHex(deviceType, 4)} (${deviceTypeName})`);
+                const hwVersion = utils_1.decodeVersion(message.readInt32LE(7));
+                const swVersion = utils_1.decodeVersion(message.readInt32LE(11));
+                modeInfoDebug(`Port ${utils_1.toHex(portId)}, hardware version ${hwVersion}, software version ${swVersion}`);
+                this._sendPortInformationRequest(portId);
+            }
+            const device = this._createDevice(deviceType, portId);
+            this._attachDevice(device);
+            // Handle device detachments
+        }
+        else if (event === 0x00) {
+            const device = this._getDeviceByPortId(portId);
+            if (device) {
+                this._detachDevice(device);
+                if (this.isPortVirtual(portId)) {
+                    const portName = this.getPortNameForPortId(portId);
+                    if (portName) {
+                        delete this._portMap[portName];
+                    }
+                    this._virtualPorts = this._virtualPorts.filter((virtualPortId) => virtualPortId !== portId);
+                }
+            }
+            // Handle virtual port creation
+        }
+        else if (event === 0x02) {
+            const firstPortName = this.getPortNameForPortId(message[7]);
+            const secondPortName = this.getPortNameForPortId(message[8]);
+            // @ts-ignore NK These should never be undefined
+            const virtualPortName = firstPortName + secondPortName;
+            const virtualPortId = message[3];
+            this._portMap[virtualPortName] = virtualPortId;
+            this._virtualPorts.push(virtualPortId);
+            const device = this._createDevice(deviceType, virtualPortId);
+            this._attachDevice(device);
+        }
+    }
+    _sendPortInformationRequest(port) {
+        this.send(Buffer.from([0x21, port, 0x01]), Consts.BLECharacteristic.LPF2_ALL);
+        this.send(Buffer.from([0x21, port, 0x02]), Consts.BLECharacteristic.LPF2_ALL); // Mode combinations
+    }
+    _parsePortInformationResponse(message) {
+        const port = message[3];
+        if (message[4] === 2) {
+            const modeCombinationMasks = [];
+            for (let i = 5; i < message.length; i += 2) {
+                modeCombinationMasks.push(message.readUInt16LE(i));
+            }
+            modeInfoDebug(`Port ${utils_1.toHex(port)}, mode combinations [${modeCombinationMasks.map((c) => utils_1.toBin(c, 0)).join(", ")}]`);
+            return;
+        }
+        const count = message[6];
+        const input = utils_1.toBin(message.readUInt16LE(7), count);
+        const output = utils_1.toBin(message.readUInt16LE(9), count);
+        modeInfoDebug(`Port ${utils_1.toHex(port)}, total modes ${count}, input modes ${input}, output modes ${output}`);
+        for (let i = 0; i < count; i++) {
+            this._sendModeInformationRequest(port, i, 0x00); // Mode Name
+            this._sendModeInformationRequest(port, i, 0x01); // RAW Range
+            this._sendModeInformationRequest(port, i, 0x02); // PCT Range
+            this._sendModeInformationRequest(port, i, 0x03); // SI Range
+            this._sendModeInformationRequest(port, i, 0x04); // SI Symbol
+            this._sendModeInformationRequest(port, i, 0x80); // Value Format
+        }
+    }
+    _sendModeInformationRequest(port, mode, type) {
+        this.send(Buffer.from([0x22, port, mode, type]), Consts.BLECharacteristic.LPF2_ALL);
+    }
+    _parseModeInformationResponse(message) {
+        const port = utils_1.toHex(message[3]);
+        const mode = message[4];
+        const type = message[5];
+        switch (type) {
+            case 0x00: // Mode Name
+                modeInfoDebug(`Port ${port}, mode ${mode}, name ${message.slice(6, message.length).toString()}`);
+                break;
+            case 0x01: // RAW Range
+                modeInfoDebug(`Port ${port}, mode ${mode}, RAW min ${message.readFloatLE(6)}, max ${message.readFloatLE(10)}`);
+                break;
+            case 0x02: // PCT Range
+                modeInfoDebug(`Port ${port}, mode ${mode}, PCT min ${message.readFloatLE(6)}, max ${message.readFloatLE(10)}`);
+                break;
+            case 0x03: // SI Range
+                modeInfoDebug(`Port ${port}, mode ${mode}, SI min ${message.readFloatLE(6)}, max ${message.readFloatLE(10)}`);
+                break;
+            case 0x04: // SI Symbol
+                modeInfoDebug(`Port ${port}, mode ${mode}, SI symbol ${message.slice(6, message.length).toString()}`);
+                break;
+            case 0x80: // Value Format
+                const numValues = message[6];
+                const dataType = ["8bit", "16bit", "32bit", "float"][message[7]];
+                const totalFigures = message[8];
+                const decimals = message[9];
+                modeInfoDebug(`Port ${port}, mode ${mode}, Value ${numValues} x ${dataType}, Decimal format ${totalFigures}.${decimals}`);
+        }
+    }
+    _parsePortAction(message) {
+        const portId = message[3];
+        const device = this._getDeviceByPortId(portId);
+        if (device) {
+            const finished = (message[4] === 0x0a);
+            if (finished) {
+                device.finish();
+            }
+        }
+    }
+    _parseSensorMessage(message) {
+        const portId = message[3];
+        const device = this._getDeviceByPortId(portId);
+        if (device) {
+            device.receive(message);
+        }
+    }
+}
+exports.LPF2Hub = LPF2Hub;
+//# sourceMappingURL=lpf2hub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_movehub.js.html b/docs/hubs_movehub.js.html new file mode 100644 index 0000000..8e2433e --- /dev/null +++ b/docs/hubs_movehub.js.html @@ -0,0 +1,277 @@ + + + + + + + node-poweredup Source: hubs/movehub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/movehub.js

+ +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const compare_versions_1 = __importDefault(require("compare-versions"));
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("movehub");
+/**
+ * The MoveHub is emitted if the discovered device is a Move Hub.
+ * @class MoveHub
+ * @extends LPF2Hub
+ * @extends BaseHub
+ */
+class MoveHub extends lpf2hub_1.LPF2Hub {
+    static IsMoveHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.MOVE_HUB_ID);
+    }
+    constructor(device) {
+        super(device, exports.PortMap, Consts.HubType.MOVE_HUB);
+        debug("Discovered Move Hub");
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Move Hub");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+    _checkFirmware(version) {
+        if (compare_versions_1.default("2.0.00.0017", version) === 1) {
+            throw new Error(`Your Move Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
+        }
+    }
+}
+exports.MoveHub = MoveHub;
+exports.PortMap = {
+    "A": 0,
+    "B": 1,
+    "C": 2,
+    "D": 3,
+    "HUB_LED": 50,
+    "TILT_SENSOR": 58,
+    "CURRENT_SENSOR": 59,
+    "VOLTAGE_SENSOR": 60
+};
+//# sourceMappingURL=movehub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_remotecontrol.js.html b/docs/hubs_remotecontrol.js.html new file mode 100644 index 0000000..e46113a --- /dev/null +++ b/docs/hubs_remotecontrol.js.html @@ -0,0 +1,265 @@ + + + + + + + node-poweredup Source: hubs/remotecontrol.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/remotecontrol.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("remotecontrol");
+/**
+ * The RemoteControl is emitted if the discovered device is a Remote Control.
+ * @class RemoteControl
+ * @extends LPF2Hub
+ * @extends BaseHub
+ */
+class RemoteControl extends lpf2hub_1.LPF2Hub {
+    static IsRemoteControl(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.REMOTE_CONTROL_ID);
+    }
+    constructor(device) {
+        super(device, exports.PortMap, Consts.HubType.REMOTE_CONTROL);
+        debug("Discovered Powered UP Remote");
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Powered UP Remote");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.RemoteControl = RemoteControl;
+exports.PortMap = {
+    "LEFT": 0,
+    "RIGHT": 1,
+    "HUB_LED": 52,
+    "VOLTAGE_SENSOR": 59,
+    "REMOTE_CONTROL_RSSI": 60
+};
+//# sourceMappingURL=remotecontrol.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_technicmediumhub.js.html b/docs/hubs_technicmediumhub.js.html new file mode 100644 index 0000000..b5791f7 --- /dev/null +++ b/docs/hubs_technicmediumhub.js.html @@ -0,0 +1,271 @@ + + + + + + + node-poweredup Source: hubs/technicmediumhub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/technicmediumhub.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("technicmediumhub");
+/**
+ * The TechnicMediumHub is emitted if the discovered device is a Technic Medium Hub.
+ * @class TechnicMediumHub
+ * @extends LPF2Hub
+ * @extends BaseHub
+ */
+class TechnicMediumHub extends lpf2hub_1.LPF2Hub {
+    static IsTechnicMediumHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.TECHNIC_MEDIUM_HUB);
+    }
+    constructor(device) {
+        super(device, exports.PortMap, Consts.HubType.TECHNIC_MEDIUM_HUB);
+        debug("Discovered Control+ Hub");
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Control+ Hub");
+            await super.connect();
+            this.send(Buffer.from([0x41, 0x3d, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL); // Temperature
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.TechnicMediumHub = TechnicMediumHub;
+exports.PortMap = {
+    "A": 0,
+    "B": 1,
+    "C": 2,
+    "D": 3,
+    "HUB_LED": 50,
+    "CURRENT_SENSOR": 59,
+    "VOLTAGE_SENSOR": 60,
+    "ACCELEROMETER": 97,
+    "GYRO_SENSOR": 98,
+    "TILT_SENSOR": 99
+};
+//# sourceMappingURL=technicmediumhub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_wedo2smarthub.js.html b/docs/hubs_wedo2smarthub.js.html new file mode 100644 index 0000000..724ce5e --- /dev/null +++ b/docs/hubs_wedo2smarthub.js.html @@ -0,0 +1,417 @@ + + + + + + + node-poweredup Source: hubs/wedo2smarthub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/wedo2smarthub.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basehub_1 = require("./basehub");
+const Consts = __importStar(require("../consts"));
+const utils_1 = require("../utils");
+const Debug = require("debug");
+const debug = Debug("wedo2smarthub");
+/**
+ * The WeDo2SmartHub is emitted if the discovered device is a WeDo 2.0 Smart Hub.
+ * @class WeDo2SmartHub
+ * @extends BaseHub
+ */
+class WeDo2SmartHub extends basehub_1.BaseHub {
+    constructor(device) {
+        super(device, exports.PortMap, Consts.HubType.WEDO2_SMART_HUB);
+        this._lastTiltX = 0;
+        this._lastTiltY = 0;
+        debug("Discovered WeDo 2.0 Smart Hub");
+    }
+    static IsWeDo2SmartHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.WEDO2_SMART_HUB.replace(/-/g, "")) >= 0);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to WeDo 2.0 Smart Hub");
+            await super.connect();
+            await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB);
+            await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_2);
+            if (!utils_1.isWebBluetooth) {
+                await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_3);
+                await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_4);
+                await this._bleDevice.discoverCharacteristicsForService(Consts.BLEService.WEDO2_SMART_HUB_5);
+            }
+            else {
+                await this._bleDevice.discoverCharacteristicsForService("battery_service");
+                await this._bleDevice.discoverCharacteristicsForService("device_information");
+            }
+            debug("Connect completed");
+            this.emit("connect");
+            resolve();
+            this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_PORT_TYPE, this._parsePortMessage.bind(this));
+            this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_SENSOR_VALUE, this._parseSensorMessage.bind(this));
+            this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_BUTTON, this._parseSensorMessage.bind(this));
+            if (!utils_1.isWebBluetooth) {
+                this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_BATTERY, this._parseBatteryMessage.bind(this));
+                this._bleDevice.readFromCharacteristic(Consts.BLECharacteristic.WEDO2_BATTERY, (err, data) => {
+                    if (data) {
+                        this._parseBatteryMessage(data);
+                    }
+                });
+            }
+            else {
+                this._bleDevice.readFromCharacteristic("00002a19-0000-1000-8000-00805f9b34fb", (err, data) => {
+                    if (data) {
+                        this._parseBatteryMessage(data);
+                    }
+                });
+                this._bleDevice.subscribeToCharacteristic("00002a19-0000-1000-8000-00805f9b34fb", this._parseHighCurrentAlert.bind(this));
+            }
+            this._bleDevice.subscribeToCharacteristic(Consts.BLECharacteristic.WEDO2_HIGH_CURRENT_ALERT, this._parseHighCurrentAlert.bind(this));
+            if (!utils_1.isWebBluetooth) {
+                this._bleDevice.readFromCharacteristic(Consts.BLECharacteristic.WEDO2_FIRMWARE_REVISION, (err, data) => {
+                    if (data) {
+                        this._parseFirmwareRevisionString(data);
+                    }
+                });
+            }
+            else {
+                this._bleDevice.readFromCharacteristic("00002a26-0000-1000-8000-00805f9b34fb", (err, data) => {
+                    if (data) {
+                        this._parseFirmwareRevisionString(data);
+                    }
+                });
+            }
+        });
+    }
+    /**
+     * Shutdown the Hub.
+     * @method WeDo2SmartHub#shutdown
+     * @returns {Promise} Resolved upon successful disconnect.
+     */
+    shutdown() {
+        return new Promise((resolve, reject) => {
+            this.send(Buffer.from([0x00]), Consts.BLECharacteristic.WEDO2_DISCONNECT, () => {
+                return resolve();
+            });
+        });
+    }
+    /**
+     * Set the name of the Hub.
+     * @method WeDo2SmartHub#setName
+     * @param {string} name New name of the hub (14 characters or less, ASCII only).
+     * @returns {Promise} Resolved upon successful issuance of command.
+     */
+    setName(name) {
+        if (name.length > 14) {
+            throw new Error("Name must be 14 characters or less");
+        }
+        return new Promise((resolve, reject) => {
+            const data = Buffer.from(name, "ascii");
+            // Send this twice, as sometimes the first time doesn't take
+            this.send(data, Consts.BLECharacteristic.WEDO2_NAME_ID);
+            this.send(data, Consts.BLECharacteristic.WEDO2_NAME_ID);
+            this._name = name;
+            return resolve();
+        });
+    }
+    send(message, uuid, callback) {
+        if (debug.enabled) {
+            debug(`Sent Message (${this._getCharacteristicNameFromUUID(uuid)})`, message);
+        }
+        this._bleDevice.writeToCharacteristic(uuid, message, callback);
+    }
+    subscribe(portId, deviceType, mode) {
+        this.send(Buffer.from([0x01, 0x02, portId, deviceType, mode, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE);
+    }
+    unsubscribe(portId, deviceType, mode) {
+        this.send(Buffer.from([0x01, 0x02, portId, deviceType, mode, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.WEDO2_PORT_TYPE_WRITE);
+    }
+    _getCharacteristicNameFromUUID(uuid) {
+        const keys = Object.keys(Consts.BLECharacteristic);
+        for (let i = 0; i < keys.length; i++) {
+            const key = keys[i];
+            if (Consts.BLECharacteristic[key] === uuid) {
+                return key;
+            }
+        }
+        return "UNKNOWN";
+    }
+    _parseHighCurrentAlert(data) {
+        debug("Received Message (WEDO2_HIGH_CURRENT_ALERT)", data);
+    }
+    _parseBatteryMessage(data) {
+        debug("Received Message (WEDO2_BATTERY)", data);
+        const batteryLevel = data[0];
+        if (batteryLevel !== this._batteryLevel) {
+            this._batteryLevel = batteryLevel;
+            this.emit("batteryLevel", { batteryLevel });
+        }
+    }
+    _parseFirmwareRevisionString(data) {
+        debug("Received Message (WEDO2_FIRMWARE_REVISION)", data);
+        this._firmwareVersion = data.toString();
+    }
+    _parsePortMessage(data) {
+        debug("Received Message (WEDO2_PORT_TYPE)", data);
+        const portId = data[0];
+        const event = data[1];
+        const deviceType = event ? data[3] : 0;
+        if (event === 0x01) {
+            const device = this._createDevice(deviceType, portId);
+            this._attachDevice(device);
+        }
+        else if (event === 0x00) {
+            const device = this._getDeviceByPortId(portId);
+            if (device) {
+                this._detachDevice(device);
+            }
+        }
+    }
+    _parseSensorMessage(message) {
+        debug("Received Message (WEDO2_SENSOR_VALUE)", message);
+        if (message[0] === 0x01) {
+            /**
+             * Emits when a button is pressed.
+             * @event WeDo2SmartHub#button
+             * @param {string} button
+             * @param {ButtonState} state
+             */
+            this.emit("button", { event: Consts.ButtonState.PRESSED });
+            return;
+        }
+        else if (message[0] === 0x00) {
+            this.emit("button", { event: Consts.ButtonState.RELEASED });
+            return;
+        }
+        const portId = message[1];
+        const device = this._getDeviceByPortId(portId);
+        if (device) {
+            device.receive(message);
+        }
+    }
+}
+exports.WeDo2SmartHub = WeDo2SmartHub;
+exports.PortMap = {
+    "A": 1,
+    "B": 2,
+    "CURRENT_SENSOR": 3,
+    "VOLTAGE_SENSOR": 4,
+    "PIEZO_BUZZER": 5,
+    "HUB_LED": 6
+};
+//# sourceMappingURL=wedo2smarthub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Fri Feb 7th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/index.html b/docs/index.html index 8df7b00..e99f5cd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,21 +33,14 @@ - - @@ -290,17 +283,22 @@ const poweredUP = new PoweredUP.PoweredUP(); poweredUP.on("discover", async (hub) => { // Wait to discover a Hub console.log(`Discovered ${hub.name}!`); await hub.connect(); // Connect to the Hub + const motorA = hub.waitForDeviceAtPort("A"); // Make sure a motor is plugged into port A + const motorB = hub.waitForDeviceAtPort("B"); // Make sure a motor is plugged into port B console.log("Connected"); - await hub.sleep(3000); // Sleep for 3 seconds before starting while (true) { // Repeat indefinitely console.log("Running motor B at speed 75"); - hub.setMotorSpeed("B", 75); // Start a motor attached to port B to run a 3/4 speed (75) indefinitely + motorB.setPower("B", 75); // Start a motor attached to port B to run a 3/4 speed (75) indefinitely console.log("Running motor A at speed 100 for 2 seconds"); - await hub.setMotorSpeed("A", 100, 2000); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop + motorA.setPower("A", 100); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop + await hub.sleep(2000); + motorA.setPower("A", 0); await hub.sleep(1000); // Do nothing for 1 second - console.log("Running motor A at speed -50 for 1 seconds"); - await hub.setMotorSpeed("A", -50, 1000); // Run a motor attached to port A for 1 second at 1/2 speed in reverse (-50) then stop + console.log("Running motor A at speed -50 for 1 second"); + motorA.setPower("A", -50); // Run a motor attached to port A for 1 second at 1/2 speed in reverse (-50) then stop + hub.sleep(1000); + motorA.setPower("A", 0); await hub.sleep(1000); // Do nothing for 1 second } }); @@ -360,7 +358,7 @@ console.log("Scanning for Hubs..."); Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Fri Feb 7th 2020 using the DocStrap template. diff --git a/docs/poweredup-node.js.html b/docs/poweredup-node.js.html index 0bfb7ae..46a1b7d 100644 --- a/docs/poweredup-node.js.html +++ b/docs/poweredup-node.js.html @@ -33,14 +33,14 @@ @@ -86,13 +86,13 @@
"use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-const boostmovehub_1 = require("./boostmovehub");
-const controlplushub_1 = require("./controlplushub");
-const duplotrainbase_1 = require("./duplotrainbase");
-const nobledevice_1 = require("./nobledevice");
-const puphub_1 = require("./puphub");
-const pupremote_1 = require("./pupremote");
-const wedo2smarthub_1 = require("./wedo2smarthub");
+const nobleabstraction_1 = require("./nobleabstraction");
+const duplotrainbase_1 = require("./hubs/duplotrainbase");
+const hub_1 = require("./hubs/hub");
+const movehub_1 = require("./hubs/movehub");
+const remotecontrol_1 = require("./hubs/remotecontrol");
+const technicmediumhub_1 = require("./hubs/technicmediumhub");
+const wedo2smarthub_1 = require("./hubs/wedo2smarthub");
 const events_1 = require("events");
 const Debug = require("debug");
 const debug = Debug("poweredup");
@@ -122,7 +122,6 @@ noble.on("stateChange", (state) => {
 class PoweredUP extends events_1.EventEmitter {
     constructor() {
         super();
-        this.autoSubscribe = true;
         this._connectedHubs = {};
         this._discoveryEventHandler = this._discoveryEventHandler.bind(this);
     }
@@ -156,60 +155,69 @@ class PoweredUP extends events_1.EventEmitter {
     }
     /**
      * Retrieve a list of Powered UP Hubs.
-     * @method PoweredUP#getConnectedHubs
-     * @returns {Hub[]}
+     * @method PoweredUP#getHubs
+     * @returns {BaseHub[]}
      */
-    getConnectedHubs() {
-        return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]);
+    getHubs() {
+        return Object.values(this._connectedHubs);
     }
     /**
      * Retrieve a Powered UP Hub by UUID.
-     * @method PoweredUP#getConnectedHubByUUID
+     * @method PoweredUP#getHubByUUID
      * @param {string} uuid
-     * @returns {Hub | null}
+     * @returns {BaseHub | null}
      */
-    getConnectedHubByUUID(uuid) {
+    getHubByUUID(uuid) {
         return this._connectedHubs[uuid];
     }
     /**
      * Retrieve a Powered UP Hub by primary MAC address.
-     * @method PoweredUP#getConnectedHubByPrimaryMACAddress
+     * @method PoweredUP#getHubByPrimaryMACAddress
      * @param {string} address
-     * @returns {Hub}
+     * @returns {BaseHub}
      */
-    getConnectedHubByPrimaryMACAddress(address) {
-        return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]).filter((hub) => hub.primaryMACAddress === address)[0];
+    getHubByPrimaryMACAddress(address) {
+        return Object.values(this._connectedHubs).filter((hub) => hub.primaryMACAddress === address)[0];
     }
     /**
      * Retrieve a list of Powered UP Hub by name.
-     * @method PoweredUP#getConnectedHubsByName
+     * @method PoweredUP#getHubsByName
      * @param {string} name
-     * @returns {Hub[]}
+     * @returns {BaseHub[]}
      */
-    getConnectedHubsByName(name) {
-        return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]).filter((hub) => hub.name === name);
+    getHubsByName(name) {
+        return Object.values(this._connectedHubs).filter((hub) => hub.name === name);
+    }
+    /**
+     * Retrieve a list of Powered UP Hub by type.
+     * @method PoweredUP#getHubsByType
+     * @param {string} name
+     * @returns {BaseHub[]}
+     */
+    getHubsByType(hubType) {
+        return Object.values(this._connectedHubs).filter((hub) => hub.type === hubType);
     }
     async _discoveryEventHandler(peripheral) {
         peripheral.removeAllListeners();
-        const device = new nobledevice_1.NobleDevice(peripheral);
+        const device = new nobleabstraction_1.NobleDevice(peripheral);
         let hub;
         if (await wedo2smarthub_1.WeDo2SmartHub.IsWeDo2SmartHub(peripheral)) {
-            hub = new wedo2smarthub_1.WeDo2SmartHub(device, this.autoSubscribe);
+            hub = new wedo2smarthub_1.WeDo2SmartHub(device);
         }
-        else if (await boostmovehub_1.BoostMoveHub.IsBoostMoveHub(peripheral)) {
-            hub = new boostmovehub_1.BoostMoveHub(device, this.autoSubscribe);
+        else if (await movehub_1.MoveHub.IsMoveHub(peripheral)) {
+            hub = new movehub_1.MoveHub(device);
         }
-        else if (await puphub_1.PUPHub.IsPUPHub(peripheral)) {
-            hub = new puphub_1.PUPHub(device, this.autoSubscribe);
+        else if (await hub_1.Hub.IsHub(peripheral)) {
+            hub = new hub_1.Hub(device);
         }
-        else if (await pupremote_1.PUPRemote.IsPUPRemote(peripheral)) {
-            hub = new pupremote_1.PUPRemote(device, this.autoSubscribe);
+        else if (await remotecontrol_1.RemoteControl.IsRemoteControl(peripheral)) {
+            hub = new remotecontrol_1.RemoteControl(device);
         }
         else if (await duplotrainbase_1.DuploTrainBase.IsDuploTrainBase(peripheral)) {
-            hub = new duplotrainbase_1.DuploTrainBase(device, this.autoSubscribe);
+            hub = new duplotrainbase_1.DuploTrainBase(device);
         }
-        else if (await controlplushub_1.ControlPlusHub.IsControlPlusHub(peripheral)) {
-            hub = new controlplushub_1.ControlPlusHub(device, this.autoSubscribe);
+        else if (await technicmediumhub_1.TechnicMediumHub.IsTechnicMediumHub(peripheral)) {
+            hub = new technicmediumhub_1.TechnicMediumHub(device);
         }
         else {
             return;
@@ -230,7 +238,7 @@ class PoweredUP extends events_1.EventEmitter {
             /**
              * Emits when a Powered UP Hub device is found.
              * @event PoweredUP#discover
-             * @param {WeDo2SmartHub | BoostMoveHub | ControlPlusHub | PUPHub | PUPRemote | DuploTrainBase} hub
+             * @param {WeDo2SmartHub | MoveHub | TechnicMediumHub | Hub | RemoteControl | DuploTrainBase} hub
              */
             this.emit("discover", hub);
         });
@@ -282,7 +290,7 @@ exports.PoweredUP = PoweredUP;
 
 	Documentation generated by JSDoc 3.6.3
 	
-		on Tue Dec 3rd 2019
+		on Fri Feb 7th 2020
 	
 	using the DocStrap template.
 
diff --git a/docs/quicksearch.html b/docs/quicksearch.html
index 1d14541..942391b 100644
--- a/docs/quicksearch.html
+++ b/docs/quicksearch.html
@@ -7,7 +7,7 @@
     
 
     
 
     
+
+
+    
+
+
+
+
+
+
+
+
+
+
+
+
+
+    
+
+
+
+
\ No newline at end of file
diff --git a/docs/BaseHub.html b/docs/BaseHub.html
index b582d8f..6edd204 100644
--- a/docs/BaseHub.html
+++ b/docs/BaseHub.html
@@ -33,14 +33,14 @@
 			
 			
 			
 			
@@ -479,7 +479,7 @@
 
         
             
-                firmwareVersion
+                hardwareVersion
             
 
             
@@ -1325,7 +1325,7 @@
 
 	Documentation generated by JSDoc 3.6.3
 	
-		on Fri Feb 7th 2020
+		on Mon Feb 10th 2020
 	
 	using the DocStrap template.
 
diff --git a/docs/BasicMotor.html b/docs/BasicMotor.html
new file mode 100644
index 0000000..9757e33
--- /dev/null
+++ b/docs/BasicMotor.html
@@ -0,0 +1,1716 @@
+
+
+
+
+	
+	
+	node-poweredup Class: BasicMotor
+
+	
+	
+
+	
+
+
+
+
+
+
+
+
+
+
+ + +
+ +
+ + +

Class: BasicMotor

+
+ +
+ +

+ BasicMotor +

+ + +
+ + +
+
+ + +
+
+

new BasicMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time + + +number + + + + +

How long the ramp should last (in milliseconds).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
power + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

stop()

+ + +
+
+ + +
+

Stop the motor.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/BoostMoveHub.html b/docs/BoostMoveHub.html index 739b94c..bc48e58 100644 --- a/docs/BoostMoveHub.html +++ b/docs/BoostMoveHub.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -209,1375 +202,12 @@ -

Members

- -
- -
-
-

<readonly> batteryLevel

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
batteryLevel - - -number - - - - -

Battery level of the hub (Percentage between 0-100)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> firmwareVersion

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
firmwareVersion - - -string - - - - -

Firmware version of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> hardwareVersion

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
firmwareVersion - - -string - - - - -

Hardware version of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> name

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - - -

Name of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> primaryMACAddress

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
primaryMACAddress - - -string - - - - -

Primary MAC address of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> rssi

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
rssi - - -number - - - - -

Signal strength of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> uuid

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uuid - - -string - - - - -

UUID of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- -
-

Methods

-
-
-

brakeMotor(port)

- - -
-
- - -
-

Fully (hard) stop the motor on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - -

connect()

@@ -1648,8 +278,8 @@
@@ -1700,6 +330,202 @@ + + + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1744,11 +570,6 @@ - -
Overrides:
-
@@ -1774,8 +595,8 @@
@@ -1832,7 +653,7 @@
-

getHubType()

+

getDeviceAtPort(portName)

@@ -1840,129 +661,7 @@
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - - - - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1997,7 +696,7 @@ - port + portName @@ -2014,7 +713,7 @@ - +

The name of the port to retrieve the device from.

@@ -2036,247 +735,12 @@
- -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeviceType - - - -
-
- - - - - - - - - -
-
-

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
fromSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time - - -number - - - - -

How long the ramp should last (in milliseconds).

- - - - -
- - - - - - - - @@ -2302,8 +766,8 @@
@@ -2332,7 +796,7 @@
-

Resolved upon successful completion of command.

+

The device attached to the port.

@@ -2343,347 +807,43 @@
-Promise - - - -
-
- - - - - -
- - - -
-
-

resetAbsolutePosition(port)

- - -
-
- - -
-

Reset the current motor position as absolute position zero

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the motor is finished).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setAbsolutePosition(port, pos [, speed])

- - -
-
- - -
-

Tell motor to goto an absolute position

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + - -
NameTypeArgumentDefaultDescription
port - - -string - - - - - - - - - - - - -
pos - - -number - - - - - - - - - - - - -

The position of the motor to go to

speed - - -number +Device | -Array.<number> +undefined - - - - <optional>
- - - - -
- - 100 - -

A value between 1 - 100 should be set (Direction does not apply when going to absolute position)

+
+ + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

+
+ + + + + + + @@ -2695,6 +855,15 @@ +
Inherited From:
+
+ +
+ @@ -2721,8 +890,8 @@
@@ -2751,7 +920,7 @@
-

Resolved upon successful completion of command (ie. once the motor is finished).

+

Array of all attached devices.

@@ -2762,7 +931,7 @@
-Promise +Array.<Device> @@ -2779,7 +948,7 @@
-

setLEDColor(color)

+

getDevicesByType(deviceType)

@@ -2787,7 +956,7 @@
-

Set the color of the LED on the Hub via a color value.

+

Retrieves an array of devices of the specified type.

@@ -2822,13 +991,13 @@ - color + deviceType -Color +number @@ -2839,7 +1008,7 @@ - +

The device type to lookup.

@@ -2861,7 +1030,7 @@
@@ -2892,8 +1061,8 @@
@@ -2922,7 +1091,7 @@
-

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

@@ -2933,962 +1102,7 @@
-Promise - - - -
- - - - - - - - - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
brightness - - -number - - - - - - - - - - -

Brightness value between 0-100 (0 is off)

time - - -number - - - - - - - <optional>
- - - - - -

How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the light is turned off.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorAngle(port, angle [, speed])

- - -
-
- - -
-

Rotate a motor by a given angle.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
port - - -string - - - - - - - - - - - - -
angle - - -number - - - - - - - - - - - - -

How much the motor should be rotated (in degrees).

speed - - -number -| - -Array.<number> - - - - - - - <optional>
- - - - - -
- - 100 - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the motor is finished).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
speed - - -number -| - -Array.<number> - - - - - - - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

time - - -number - - - - - - - <optional>
- - - - - -

How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the motor is finished.

-
- - - -
-
- Type -
-
- -Promise +Array.<Device> @@ -4018,8 +1232,8 @@
@@ -4139,8 +1353,8 @@
@@ -4206,7 +1420,7 @@

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

+

Note: This is a helper method to make it easier to add delays into a chain of commands.

@@ -4286,11 +1500,6 @@
- -
Overrides:
-
@@ -4316,8 +1525,8 @@
@@ -4368,402 +1577,6 @@ - - - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -4779,7 +1592,7 @@

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

+

Note: This is a helper method to make it easier to wait for concurrent commands to complete.

@@ -4859,11 +1672,6 @@ - -
Overrides:
-
@@ -4889,8 +1697,8 @@
@@ -4943,19 +1751,11 @@ - - - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -4963,7 +1763,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Retrieves the device attached to a given port, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -4998,7 +1799,7 @@ - port + portName @@ -5015,79 +1816,7 @@ - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z - - - - - -number - - - - - - - - - - - +

The name of the port to retrieve the device from.

@@ -5109,7 +1838,7 @@
@@ -5140,8 +1869,8 @@
@@ -5166,6 +1895,30 @@ +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + @@ -5174,7 +1927,7 @@
-

attach

+

waitForDeviceByType(deviceType)

@@ -5182,7 +1935,8 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -5217,13 +1971,13 @@ - port + deviceType -string +number @@ -5234,20 +1988,175 @@ - +

The device type to lookup.

+ + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + + + +
+ + + + + +

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + + @@ -2036,247 +735,12 @@
- -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeviceType - - - -
-
- - - - - - - - - -
-
-

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - -
NameTypeDescription
typedevice -DeviceType +Device @@ -5286,11 +2195,6 @@ - -
Overrides:
-
@@ -5316,8 +2220,8 @@
@@ -5423,7 +2327,7 @@
-ButtonState +ButtonState @@ -5487,374 +2391,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5895,7 +2433,7 @@
-

Emits when an attached motor or sensor is detached from the Hub.

+

Emits when a device is detached from the Hub.

@@ -5930,13 +2468,13 @@
portdevice -string +Device @@ -5975,11 +2513,6 @@ - -
Overrides:
-
@@ -6005,8 +2538,8 @@
@@ -6077,11 +2610,6 @@ - -
Overrides:
-
@@ -6107,1130 +2635,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

(Only available when using a Control+ Hub)

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -7309,7 +2715,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/ColorDistanceSensor.html b/docs/ColorDistanceSensor.html new file mode 100644 index 0000000..30697a5 --- /dev/null +++ b/docs/ColorDistanceSensor.html @@ -0,0 +1,1576 @@ + + + + + + + node-poweredup Class: ColorDistanceSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: ColorDistanceSensor

+
+ +
+ +

+ ColorDistanceSensor +

+ + +
+ + +
+
+ + +
+
+

new ColorDistanceSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

colorAndDistance

+ + +
+
+ + +
+

A combined color and distance event, emits when the sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
distance + + +number + + + + +

Distance, in millimeters.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

distance

+ + +
+
+ + +
+

Emits when a distance sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + +

Distance, in millimeters.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/ControlPlusHub.html b/docs/ControlPlusHub.html index 0c2287e..44f68ea 100644 --- a/docs/ControlPlusHub.html +++ b/docs/ControlPlusHub.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -209,1375 +202,12 @@ -

Members

- -
- -
-
-

<readonly> batteryLevel

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
batteryLevel - - -number - - - - -

Battery level of the hub (Percentage between 0-100)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> firmwareVersion

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
firmwareVersion - - -string - - - - -

Firmware version of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> hardwareVersion

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
firmwareVersion - - -string - - - - -

Hardware version of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> name

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - - -

Name of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> primaryMACAddress

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
primaryMACAddress - - -string - - - - -

Primary MAC address of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> rssi

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
rssi - - -number - - - - -

Signal strength of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> uuid

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uuid - - -string - - - - -

UUID of the hub

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - -
- -
-

Methods

-
-
-

brakeMotor(port)

- - -
-
- - -
-

Fully (hard) stop the motor on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - -

connect()

@@ -1648,8 +278,8 @@
@@ -1700,6 +330,202 @@ +
+ + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1744,11 +570,6 @@ - -
Overrides:
-
@@ -1774,8 +595,8 @@
@@ -1832,7 +653,7 @@
-

getHubType()

+

getDeviceAtPort(portName)

@@ -1840,129 +661,7 @@
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - - - - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1997,7 +696,7 @@
portportName @@ -2014,7 +713,7 @@ -

The name of the port to retrieve the device from.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
fromSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time - - -number - - - - -

How long the ramp should last (in milliseconds).

- - - - -
- - - - - - - - @@ -2302,8 +766,8 @@
@@ -2332,7 +796,7 @@
-

Resolved upon successful completion of command.

+

The device attached to the port.

@@ -2343,347 +807,43 @@
-Promise - - - -
-
- - - - - -
- - - -
-
-

resetAbsolutePosition(port)

- - -
-
- - -
-

Reset the current motor position as absolute position zero

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the motor is finished).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setAbsolutePosition(port, pos [, speed])

- - -
-
- - -
-

Tell motor to goto an absolute position

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + - -
NameTypeArgumentDefaultDescription
port - - -string - - - - - - - - - - - - -
pos - - -number - - - - - - - - - - - - -

The position of the motor to go to

speed - - -number +Device | -Array.<number> +undefined - - - - <optional>
- - - - -
- - 100 - -

A value between 1 - 100 should be set (Direction does not apply when going to absolute position)

+
+ + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

+
+ + + + + + + @@ -2695,6 +855,15 @@ +
Inherited From:
+
+ +
+ @@ -2721,8 +890,8 @@
@@ -2751,7 +920,7 @@
-

Resolved upon successful completion of command (ie. once the motor is finished).

+

Array of all attached devices.

@@ -2762,7 +931,7 @@
-Promise +Array.<Device> @@ -2779,7 +948,7 @@
-

setLEDColor(color)

+

getDevicesByType(deviceType)

@@ -2787,7 +956,7 @@
-

Set the color of the LED on the Hub via a color value.

+

Retrieves an array of devices of the specified type.

@@ -2822,13 +991,13 @@ - color + deviceType -Color +number @@ -2839,7 +1008,7 @@ - +

The device type to lookup.

@@ -2861,7 +1030,7 @@
@@ -2892,8 +1061,8 @@
@@ -2922,7 +1091,7 @@
-

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

@@ -2933,962 +1102,7 @@
-Promise - - - -
-
- - - - - - - - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
brightness - - -number - - - - - - - - - - -

Brightness value between 0-100 (0 is off)

time - - -number - - - - - - - <optional>
- - - - - -

How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the light is turned off.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorAngle(port, angle [, speed])

- - -
-
- - -
-

Rotate a motor by a given angle.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
port - - -string - - - - - - - - - - - - -
angle - - -number - - - - - - - - - - - - -

How much the motor should be rotated (in degrees).

speed - - -number -| - -Array.<number> - - - - - - - <optional>
- - - - - -
- - 100 - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the motor is finished).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
speed - - -number -| - -Array.<number> - - - - - - - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

time - - -number - - - - - - - <optional>
- - - - - -

How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the motor is finished.

-
- - - -
-
- Type -
-
- -Promise +Array.<Device> @@ -4018,8 +1232,8 @@
@@ -4139,8 +1353,8 @@
@@ -4206,7 +1420,7 @@

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

+

Note: This is a helper method to make it easier to add delays into a chain of commands.

@@ -4286,11 +1500,6 @@
- -
Overrides:
-
@@ -4316,8 +1525,8 @@
@@ -4368,402 +1577,6 @@ - - - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -4779,7 +1592,7 @@

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

+

Note: This is a helper method to make it easier to wait for concurrent commands to complete.

@@ -4859,11 +1672,6 @@ - -
Overrides:
-
@@ -4889,8 +1697,8 @@
@@ -4943,19 +1751,11 @@ - - - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -4963,7 +1763,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Retrieves the device attached to a given port, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -4998,7 +1799,7 @@ - port + portName @@ -5015,79 +1816,7 @@ - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z - - - - - -number - - - - - - - - - - - +

The name of the port to retrieve the device from.

@@ -5109,7 +1838,7 @@
@@ -5140,8 +1869,8 @@
@@ -5166,6 +1895,30 @@ +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + @@ -5174,7 +1927,7 @@
-

attach

+

waitForDeviceByType(deviceType)

@@ -5182,7 +1935,8 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -5217,13 +1971,13 @@ - port + deviceType -string +number @@ -5234,20 +1988,175 @@ - +

The device type to lookup.

+ + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + + + +
+ + + + + +

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2366,15 +2922,6 @@ -
Inherited From:
-
- -
- @@ -2401,8 +2948,8 @@
@@ -2427,12 +2974,207 @@ +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + +
+
+

waitForDeviceByType(deviceType)

+ + +
+
+ + +
+

Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

+
+ + + + + + + + +
Parameters:
+ + +
NameTypeDescription
typedevice -DeviceType +Device @@ -5286,11 +2195,6 @@ - -
Overrides:
-
@@ -5316,8 +2220,8 @@
@@ -5423,7 +2327,7 @@
-ButtonState +ButtonState @@ -5487,374 +2391,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5895,7 +2433,7 @@
-

Emits when an attached motor or sensor is detached from the Hub.

+

Emits when a device is detached from the Hub.

@@ -5930,13 +2468,13 @@
portdevice -string +Device @@ -5975,11 +2513,6 @@ - -
Overrides:
-
@@ -6005,8 +2538,8 @@
@@ -6077,11 +2610,6 @@ - -
Overrides:
-
@@ -6107,1130 +2635,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

(Only available when using a Control+ Hub)

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -7309,7 +2715,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/CurrentSensor.html b/docs/CurrentSensor.html new file mode 100644 index 0000000..f34476a --- /dev/null +++ b/docs/CurrentSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: CurrentSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: CurrentSensor

+
+ +
+ +

+ CurrentSensor +

+ + +
+ + +
+
+ + +
+
+

new CurrentSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

current

+ + +
+
+ + +
+

Emits when a current change is detected.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
current + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Device.html b/docs/Device.html new file mode 100644 index 0000000..015810e --- /dev/null +++ b/docs/Device.html @@ -0,0 +1,1062 @@ + + + + + + + node-poweredup Class: Device + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: Device

+
+ +
+ +

+ Device +

+ + +
+ + +
+
+ + +
+
+

new Device()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + +
    +
  • EventEmitter
  • +
+ + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html index 48883ed..c00f748 100644 --- a/docs/DuploTrainBase.html +++ b/docs/DuploTrainBase.html @@ -33,14 +33,14 @@ @@ -503,7 +503,7 @@
firmwareVersionhardwareVersion @@ -1364,6 +1364,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + +

setName(name)

@@ -1664,225 +1860,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -2023,178 +2000,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2273,7 +2079,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/DuploTrainBaseColorSensor.html b/docs/DuploTrainBaseColorSensor.html new file mode 100644 index 0000000..9cdafe9 --- /dev/null +++ b/docs/DuploTrainBaseColorSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: DuploTrainBaseColorSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTrainBaseColorSensor

+
+ +
+ +

+ DuploTrainBaseColorSensor +

+ + +
+ + +
+
+ + +
+
+

new DuploTrainBaseColorSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBaseMotor.html b/docs/DuploTrainBaseMotor.html new file mode 100644 index 0000000..a3b6dba --- /dev/null +++ b/docs/DuploTrainBaseMotor.html @@ -0,0 +1,1752 @@ + + + + + + + node-poweredup Class: DuploTrainBaseMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTrainBaseMotor

+
+ +
+ +

+ DuploTrainBaseMotor +

+ + +
+ + +
+
+ + +
+
+

new DuploTrainBaseMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time + + +number + + + + +

How long the ramp should last (in milliseconds).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
power + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

stop()

+ + +
+
+ + +
+

Stop the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBaseSpeaker.html b/docs/DuploTrainBaseSpeaker.html new file mode 100644 index 0000000..618b18d --- /dev/null +++ b/docs/DuploTrainBaseSpeaker.html @@ -0,0 +1,1282 @@ + + + + + + + node-poweredup Class: DuploTrainBaseSpeaker + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTrainBaseSpeaker

+
+ +
+ +

+ DuploTrainBaseSpeaker +

+ + +
+ + +
+
+ + +
+
+

new DuploTrainBaseSpeaker()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

playSound(sound)

+ + +
+
+ + +
+

Play a built-in train sound.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sound + + +DuploTrainBaseSound + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTraniBaseSpeedometer.html b/docs/DuploTraniBaseSpeedometer.html new file mode 100644 index 0000000..f2a4418 --- /dev/null +++ b/docs/DuploTraniBaseSpeedometer.html @@ -0,0 +1,1116 @@ + + + + + + + node-poweredup Class: DuploTraniBaseSpeedometer + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTraniBaseSpeedometer

+
+ +
+ +

+ DuploTraniBaseSpeedometer +

+ + +
+ + +
+
+ + +
+
+

new DuploTraniBaseSpeedometer()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Hub.html b/docs/Hub.html index 1999914..e9f93d3 100644 --- a/docs/Hub.html +++ b/docs/Hub.html @@ -33,14 +33,14 @@ @@ -503,7 +503,7 @@
firmwareVersionhardwareVersion @@ -1472,6 +1472,202 @@ + + + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1584,6 +1780,445 @@ + + + + +
+
+

getDeviceAtPort(portName)

+ + +
+
+ + +
+

Retrieves the device attached to a given port.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The name of the port to retrieve the device from.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

The device attached to the port.

+
+ + + +
+
+ Type +
+
+ +Device +| + +undefined + + + +
+
+ + + + + +
+ + + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Array of all attached devices.

+
+ + + +
+
+ Type +
+
+ +Array.<Device> + + + +
+
+ + + + + +
+ + + +
+
+

getDevicesByType(deviceType)

+ + +
+
+ + +
+

Retrieves an array of devices of the specified type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
deviceType + + +number + + + + +

The device type to lookup.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Array of all devices of the specified type.

+
+ + + +
+
+ Type +
+
+ +Array.<Device> + + + +
+
+ + + + +
@@ -1891,7 +2526,7 @@

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

+

Note: This is a helper method to make it easier to add delays into a chain of commands.

@@ -1988,7 +2623,7 @@ @@ -2054,7 +2689,7 @@

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

+

Note: This is a helper method to make it easier to wait for concurrent commands to complete.

@@ -2151,7 +2786,7 @@ @@ -2204,19 +2839,11 @@ - - - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -2224,7 +2851,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Retrieves the device attached to a given port, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -2259,7 +2887,7 @@
portportName @@ -2276,79 +2904,7 @@ -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

The name of the port to retrieve the device from.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
deviceType + + +number + + + + +

The device type to lookup.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+

attach

@@ -2484,7 +3226,7 @@ -Device +Device @@ -2540,145 +3282,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

attach

- - -
-
- - -
-

Emits when a device is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
device - - -Device - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2849,7 +3453,145 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2964,177 +3706,6 @@ -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - -
@@ -3187,7 +3758,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/HubLED.html b/docs/HubLED.html new file mode 100644 index 0000000..5c68025 --- /dev/null +++ b/docs/HubLED.html @@ -0,0 +1,1492 @@ + + + + + + + node-poweredup Class: HubLED + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: HubLED

+
+ +
+ +

+ HubLED +

+ + +
+ + +
+
+ + +
+
+

new HubLED()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

setColor(color)

+ + +
+
+ + +
+

Set the color of the LED on the Hub via a color value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setRGB(red, green, blue)

+ + +
+
+ + +
+

Set the color of the LED on the Hub via RGB values.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
red + + +number + + + + +
green + + +number + + + + +
blue + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html index 9a8d0b4..0410915 100644 --- a/docs/LPF2Hub.html +++ b/docs/LPF2Hub.html @@ -33,14 +33,14 @@ @@ -497,7 +497,7 @@ - firmwareVersion + hardwareVersion @@ -1358,6 +1358,193 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + +

setName(name)

@@ -1640,216 +1827,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -1981,169 +1958,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2222,7 +2037,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/Light.html b/docs/Light.html new file mode 100644 index 0000000..5314026 --- /dev/null +++ b/docs/Light.html @@ -0,0 +1,1492 @@ + + + + + + + node-poweredup Class: Light + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: Light

+
+ +
+ +

+ Light +

+ + +
+ + +
+
+ + +
+
+

new Light()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

rampBrightness(fromBrightness, toBrightness, time)

+ + +
+
+ + +
+

Ramp the light brightness.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromBrightness + + +number + + + + +

Brightness value between 0-100 (0 is off)

toBrightness + + +number + + + + +

Brightness value between 0-100 (0 is off)

time + + +number + + + + +

How long the ramp should last (in milliseconds).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrightness(brightness)

+ + +
+
+ + +
+

Set the light brightness.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
brightness + + +number + + + + +

Brightness value between 0-100 (0 is off)

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MediumLinearMotor.html b/docs/MediumLinearMotor.html new file mode 100644 index 0000000..4e32bc7 --- /dev/null +++ b/docs/MediumLinearMotor.html @@ -0,0 +1,1051 @@ + + + + + + + node-poweredup Class: MediumLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MediumLinearMotor

+
+ +
+ +

+ MediumLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new MediumLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MotionSensor.html b/docs/MotionSensor.html new file mode 100644 index 0000000..7601a20 --- /dev/null +++ b/docs/MotionSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: MotionSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MotionSensor

+
+ +
+ +

+ MotionSensor +

+ + +
+ + +
+
+ + +
+
+

new MotionSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

distance

+ + +
+
+ + +
+

Emits when a distance sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + +

Distance, in millimeters.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MoveHub.html b/docs/MoveHub.html index 1dc1a1f..a454da0 100644 --- a/docs/MoveHub.html +++ b/docs/MoveHub.html @@ -33,14 +33,14 @@ @@ -513,7 +513,7 @@ - firmwareVersion + hardwareVersion @@ -1409,6 +1409,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + +

setName(name)

@@ -1709,225 +1905,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -2068,178 +2045,7 @@ -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2318,7 +2124,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/MoveHubMediumLinearMotor.html b/docs/MoveHubMediumLinearMotor.html new file mode 100644 index 0000000..295c052 --- /dev/null +++ b/docs/MoveHubMediumLinearMotor.html @@ -0,0 +1,1051 @@ + + + + + + + node-poweredup Class: MoveHubMediumLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MoveHubMediumLinearMotor

+
+ +
+ +

+ MoveHubMediumLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new MoveHubMediumLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MoveHubTiltSensor.html b/docs/MoveHubTiltSensor.html new file mode 100644 index 0000000..c73b163 --- /dev/null +++ b/docs/MoveHubTiltSensor.html @@ -0,0 +1,1288 @@ + + + + + + + node-poweredup Class: MoveHubTiltSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MoveHubTiltSensor

+
+ +
+ +

+ MoveHubTiltSensor +

+ + +
+ + +
+
+ + +
+
+

new MoveHubTiltSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/PUPHub.html b/docs/PUPHub.html index fa01e54..88d3fbd 100644 --- a/docs/PUPHub.html +++ b/docs/PUPHub.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -290,7 +283,7 @@
@@ -326,141 +319,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -556,7 +416,7 @@
@@ -592,8 +452,8 @@
@@ -653,7 +513,7 @@ - firmwareVersion + hardwareVersion @@ -689,7 +549,7 @@
@@ -725,8 +585,8 @@
@@ -822,7 +682,7 @@
@@ -858,8 +718,141 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -955,7 +948,7 @@
@@ -991,8 +984,8 @@
@@ -1088,7 +1081,7 @@
@@ -1124,8 +1117,141 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1221,7 +1347,7 @@
@@ -1257,141 +1383,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1416,168 +1409,6 @@
-
-
-

brakeMotor(port)

- - -
-
- - -
-

Fully (hard) stop the motor on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - -

connect()

@@ -1648,8 +1479,8 @@
@@ -1700,6 +1531,207 @@ +
+ + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1744,11 +1776,6 @@ - -
Overrides:
-
@@ -1774,8 +1801,8 @@
@@ -1832,7 +1859,7 @@
-

getHubType()

+

getDeviceAtPort(portName)

@@ -1840,129 +1867,7 @@
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - - - - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1997,7 +1902,7 @@ - port + portName @@ -2014,7 +1919,7 @@ - +

The name of the port to retrieve the device from.

@@ -2036,247 +1941,12 @@
- -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeviceType - - - -
-
- - - - - - - - - -
-
-

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
fromSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toSpeed - - -number - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time - - -number - - - - -

How long the ramp should last (in milliseconds).

- - - - -
- - - - - - - - @@ -2302,8 +1972,8 @@
@@ -2332,7 +2002,7 @@
-

Resolved upon successful completion of command.

+

The device attached to the port.

@@ -2343,347 +2013,43 @@
-Promise - - - -
-
- - - - - -
- - - -
-
-

resetAbsolutePosition(port)

- - -
-
- - -
-

Reset the current motor position as absolute position zero

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the motor is finished).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setAbsolutePosition(port, pos [, speed])

- - -
-
- - -
-

Tell motor to goto an absolute position

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + - -
NameTypeArgumentDefaultDescription
port - - -string - - - - - - - - - - - - -
pos - - -number - - - - - - - - - - - - -

The position of the motor to go to

speed - - -number +Device | -Array.<number> +undefined - - - - <optional>
- - - - -
- - 100 - -

A value between 1 - 100 should be set (Direction does not apply when going to absolute position)

+
+ + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

+
+ + + + + + + @@ -2695,6 +2061,15 @@ +
Inherited From:
+
+ +
+ @@ -2721,8 +2096,8 @@
@@ -2751,7 +2126,7 @@
-

Resolved upon successful completion of command (ie. once the motor is finished).

+

Array of all attached devices.

@@ -2762,7 +2137,7 @@
-Promise +Array.<Device> @@ -2779,7 +2154,7 @@
-

setLEDColor(color)

+

getDevicesByType(deviceType)

@@ -2787,7 +2162,7 @@
-

Set the color of the LED on the Hub via a color value.

+

Retrieves an array of devices of the specified type.

@@ -2822,13 +2197,13 @@ - color + deviceType -Color +number @@ -2839,7 +2214,7 @@ - +

The device type to lookup.

@@ -2861,7 +2236,7 @@
@@ -2892,8 +2267,8 @@
@@ -2922,7 +2297,7 @@
-

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

@@ -2933,962 +2308,7 @@
-Promise - - - -
- - - - - - - - - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
brightness - - -number - - - - - - - - - - -

Brightness value between 0-100 (0 is off)

time - - -number - - - - - - - <optional>
- - - - - -

How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the light is turned off.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorAngle(port, angle [, speed])

- - -
-
- - -
-

Rotate a motor by a given angle.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDefaultDescription
port - - -string - - - - - - - - - - - - -
angle - - -number - - - - - - - - - - - - -

How much the motor should be rotated (in degrees).

speed - - -number -| - -Array.<number> - - - - - - - <optional>
- - - - - -
- - 100 - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command (ie. once the motor is finished).

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
speed - - -number -| - -Array.<number> - - - - - - - - - - -

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds.

time - - -number - - - - - - - <optional>
- - - - - -

How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely.

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful completion of command. If time is specified, this is once the motor is finished.

-
- - - -
-
- Type -
-
- -Promise +Array.<Device> @@ -3993,6 +2413,11 @@
+ +
Overrides:
+
@@ -4018,8 +2443,8 @@
@@ -4114,6 +2539,11 @@
+ +
Overrides:
+
@@ -4139,8 +2569,8 @@
@@ -4206,7 +2636,7 @@

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

+

Note: This is a helper method to make it easier to add delays into a chain of commands.

@@ -4286,11 +2716,6 @@ - -
Overrides:
-
@@ -4316,8 +2741,8 @@
@@ -4368,402 +2793,6 @@ - - - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -4779,7 +2808,7 @@

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

+

Note: This is a helper method to make it easier to wait for concurrent commands to complete.

@@ -4859,11 +2888,6 @@ - -
Overrides:
-
@@ -4889,8 +2913,8 @@
@@ -4943,19 +2967,11 @@ - - - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -4963,7 +2979,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Retrieves the device attached to a given port, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -4998,7 +3015,7 @@ - port + portName @@ -5015,79 +3032,7 @@ - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z - - - - - -number - - - - - - - - - - - +

The name of the port to retrieve the device from.

@@ -5109,7 +3054,7 @@
@@ -5140,8 +3085,8 @@
@@ -5166,6 +3111,30 @@ +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + @@ -5174,7 +3143,7 @@
-

attach

+

waitForDeviceByType(deviceType)

@@ -5182,7 +3151,8 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -5217,13 +3187,13 @@ - port + deviceType -string +number @@ -5234,20 +3204,175 @@ - +

The device type to lookup.

+ + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + + + +
+ + + + + +

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + - + + @@ -1874,17 +1941,12 @@
- -
Overrides:
-
@@ -1910,8 +1972,8 @@
@@ -1939,6 +2001,10 @@
Returns:
+
+

The device attached to the port.

+
+
@@ -1947,7 +2013,10 @@
-DeviceType +Device +| + +undefined @@ -1964,7 +2033,7 @@
-

setLEDColor(color)

+

getDevices()

@@ -1972,7 +2041,128 @@
-

Set the color of the LED on the Hub via a color value.

+

Retrieves all attached devices.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Array of all attached devices.

+
+ + + +
+
+ Type +
+
+ +Array.<Device> + + + +
+
+ + + + + + + + + +
+
+

getDevicesByType(deviceType)

+ + +
+
+ + +
+

Retrieves an array of devices of the specified type.

@@ -2007,13 +2197,13 @@
- + + @@ -2046,7 +2236,7 @@
@@ -2077,8 +2267,8 @@
@@ -2107,7 +2297,7 @@
-

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

@@ -2118,226 +2308,7 @@
-Promise - - - -
- - - - - - - - - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

Set the color of the LED on the Hub via RGB values.

-
- - - - - - - - -
Parameters:
- - -
NameTypeDescription
typedevice -DeviceType +Device @@ -5286,11 +3411,6 @@ - -
Overrides:
-
@@ -5316,8 +3436,8 @@
@@ -5423,7 +3543,7 @@
-ButtonState +ButtonState @@ -5463,176 +3583,10 @@ - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - +
Overrides:
+
@@ -5658,203 +3612,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5895,7 +3654,7 @@
-

Emits when an attached motor or sensor is detached from the Hub.

+

Emits when a device is detached from the Hub.

@@ -5930,13 +3689,13 @@
portdevice -string +Device @@ -5975,11 +3734,6 @@ - -
Overrides:
-
@@ -6005,8 +3759,8 @@
@@ -6077,11 +3831,6 @@ - -
Overrides:
-
@@ -6107,1130 +3856,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

(Only available when using a Control+ Hub)

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -7309,7 +3936,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/PUPRemote.html b/docs/PUPRemote.html index 06ab35c..10d29b7 100644 --- a/docs/PUPRemote.html +++ b/docs/PUPRemote.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -290,7 +283,7 @@
@@ -326,141 +319,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
current - - -number - - - - -

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -556,7 +416,7 @@
@@ -592,8 +452,8 @@
@@ -653,7 +513,7 @@
firmwareVersionhardwareVersion @@ -689,7 +549,7 @@
@@ -725,8 +585,8 @@
@@ -822,7 +682,7 @@
@@ -858,8 +718,141 @@
+
+ + + + + + + + + + + + + + + +
+
+

<readonly> ports

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ports + + +Array.<string> + + + + +

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -955,7 +948,7 @@
@@ -991,8 +984,8 @@
@@ -1088,7 +1081,7 @@
@@ -1124,8 +1117,141 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + +

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1221,7 +1347,7 @@
@@ -1257,141 +1383,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

- - -
-
- - - - - -
- - -
Properties:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
voltage - - -number - - - - -

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1486,8 +1479,8 @@
@@ -1538,6 +1531,207 @@ +
+ + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1582,11 +1776,6 @@ - -
Overrides:
-
@@ -1612,8 +1801,8 @@
@@ -1670,7 +1859,7 @@
-

getHubType()

+

getDeviceAtPort(portName)

@@ -1678,129 +1867,7 @@
-

Get the hub type.

-
- - - - - - - - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HubType - - - -
-
- - - - - - - - - -
-
-

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1835,7 +1902,7 @@
portportName @@ -1852,7 +1919,7 @@ -

The name of the port to retrieve the device from.

colordeviceType -Color +number @@ -2024,7 +2214,7 @@ -

The device type to lookup.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
red - - -number - - - - -
green - - -number - - - - -
blue - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise +Array.<Device> @@ -2442,6 +2413,11 @@
+ +
Overrides:
+
@@ -2467,8 +2443,8 @@
@@ -2563,6 +2539,11 @@
+ +
Overrides:
+
@@ -2588,8 +2569,8 @@
@@ -2655,7 +2636,7 @@

Sleep a given amount of time.

-

This is a helper method to make it easier to add delays into a chain of commands.

+

Note: This is a helper method to make it easier to add delays into a chain of commands.

@@ -2735,11 +2716,6 @@ - -
Overrides:
-
@@ -2765,8 +2741,8 @@
@@ -2817,402 +2793,6 @@ - - - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
port - - -string - - - - - - - - - - -
mode - - -number - - - - - - - <optional>
- - - - - -

The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
-

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -3228,7 +2808,7 @@

Wait until a given list of concurrently running commands are complete.

-

This is a helper method to make it easier to wait for concurrent commands to complete.

+

Note: This is a helper method to make it easier to wait for concurrent commands to complete.

@@ -3308,11 +2888,6 @@ - -
Overrides:
-
@@ -3338,8 +2913,8 @@
@@ -3392,19 +2967,11 @@ -
- - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -3412,7 +2979,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Retrieves the device attached to a given port, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -3447,7 +3015,7 @@ - port + portName @@ -3464,79 +3032,7 @@ - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z - - - - - -number - - - - - - - - - - - +

The name of the port to retrieve the device from.

@@ -3558,7 +3054,7 @@
@@ -3589,8 +3085,8 @@
@@ -3615,6 +3111,30 @@ +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + @@ -3623,7 +3143,7 @@
-

attach

+

waitForDeviceByType(deviceType)

@@ -3631,7 +3151,8 @@
-

Emits when a motor or sensor is attached to the Hub.

+

Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.

+

Note: If a device is never attached, the returned promise may never resolve.

@@ -3666,13 +3187,13 @@ - port + deviceType -string +number @@ -3683,20 +3204,175 @@ - +

The device type to lookup.

+ + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved once a device is attached, or resolved immediately if a device is already attached.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + + + +
+ + + + + +

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -4998,7 +5963,7 @@ @@ -5046,6 +6011,12 @@ +
Type: +object + + +
+ @@ -5136,7 +6107,7 @@ @@ -5169,7 +6140,7 @@
-

from 0 to 100.

+

reflect

@@ -5184,6 +6155,12 @@ +
Type: +object + + +
+ @@ -5229,7 +6206,7 @@ - + @@ -5274,7 +6251,7 @@ @@ -5307,7 +6284,7 @@
-

from 40 to 2500mm

+

distance

@@ -5322,6 +6299,12 @@ +
Type: +object + + +
+ @@ -5367,7 +6350,7 @@ - + @@ -5412,7 +6395,7 @@ @@ -5445,7 +6428,7 @@
-

from 50 to 320mm

+

fastDistance

@@ -5460,6 +6443,12 @@ +
Type: +object + + +
+ @@ -5505,7 +6494,7 @@ - + @@ -5550,7 +6539,7 @@ @@ -5583,145 +6572,7 @@
-

touch Touched on/off (boolean).

- - -
-
- - -
-

Emits when the sensor is touched.

-
- - - - - - - - -
Parameters:
- - -
NameTypeDescription
typedevice -DeviceType +Device @@ -3735,11 +3411,6 @@ - -
Overrides:
-
@@ -3765,8 +3436,8 @@
@@ -3872,7 +3543,7 @@
-ButtonState +ButtonState @@ -3912,176 +3583,10 @@ - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - +
Overrides:
+
@@ -4107,203 +3612,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

A combined color and distance event, emits when the sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -4344,7 +3654,7 @@
-

Emits when an attached motor or sensor is detached from the Hub.

+

Emits when a device is detached from the Hub.

@@ -4379,13 +3689,13 @@
portdevice -string +Device @@ -4424,11 +3734,6 @@ - -
Overrides:
-
@@ -4454,8 +3759,8 @@
@@ -4526,11 +3831,6 @@ - -
Overrides:
-
@@ -4556,1130 +3856,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
distance - - -number - - - - -

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

gyro

- - -
-
- - -
-

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
rotation - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

speed

- - -
-
- - -
-

Emits on a speed change.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
speed - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

temp

- - -
-
- - -
-

Emits when a change is detected on a temperature sensor. Measured in degrees centigrade.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

For Control+ Hubs, port will be "CPU" as the sensor reports CPU temperature.

temp - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -

If the event is fired from the Move Hub or Control+ Hub's in-built tilt sensor, the special port "TILT" is used.

x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

(Only available when using a Control+ Hub)

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -5758,7 +3936,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/PiezoBuzzer.html b/docs/PiezoBuzzer.html new file mode 100644 index 0000000..4e69e3d --- /dev/null +++ b/docs/PiezoBuzzer.html @@ -0,0 +1,1306 @@ + + + + + + + node-poweredup Class: PiezoBuzzer + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: PiezoBuzzer

+
+ +
+ +

+ PiezoBuzzer +

+ + +
+ + +
+
+ + +
+
+

new PiezoBuzzer()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

playTone(frequency, time)

+ + +
+
+ + +
+

Play a tone on the Hub's in-built buzzer

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
frequency + + +number + + + + +
time + + +number + + + + +

How long the tone should play for (in milliseconds).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the tone has finished playing).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/RemoteControl.html b/docs/RemoteControl.html index 21f65a4..1872331 100644 --- a/docs/RemoteControl.html +++ b/docs/RemoteControl.html @@ -33,14 +33,14 @@ @@ -513,7 +513,7 @@
firmwareVersionhardwareVersion @@ -1409,6 +1409,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + +

setName(name)

@@ -1709,225 +1905,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -2068,178 +2045,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2318,7 +2124,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/RemoteControlButton.html b/docs/RemoteControlButton.html new file mode 100644 index 0000000..0e540b1 --- /dev/null +++ b/docs/RemoteControlButton.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: RemoteControlButton + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: RemoteControlButton

+
+ +
+ +

+ RemoteControlButton +

+ + +
+ + +
+
+ + +
+
+

new RemoteControlButton()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

button

+ + +
+
+ + +
+

Emits when a button on the remote is pressed or released.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/SimpleMediumLinearMotor.html b/docs/SimpleMediumLinearMotor.html new file mode 100644 index 0000000..ddd2005 --- /dev/null +++ b/docs/SimpleMediumLinearMotor.html @@ -0,0 +1,1116 @@ + + + + + + + node-poweredup Class: SimpleMediumLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: SimpleMediumLinearMotor

+
+ +
+ +

+ SimpleMediumLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new SimpleMediumLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TachoMotor.html b/docs/TachoMotor.html new file mode 100644 index 0000000..c4301ef --- /dev/null +++ b/docs/TachoMotor.html @@ -0,0 +1,2419 @@ + + + + + + + node-poweredup Class: TachoMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TachoMotor

+
+ +
+ +

+ TachoMotor +

+ + +
+ + +
+
+ + +
+
+

new TachoMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time + + +number + + + + +

How long the ramp should last (in milliseconds).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
power + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

stop()

+ + +
+
+ + +
+

Stop the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicColorSensor.html b/docs/TechnicColorSensor.html new file mode 100644 index 0000000..fff63e9 --- /dev/null +++ b/docs/TechnicColorSensor.html @@ -0,0 +1,1552 @@ + + + + + + + node-poweredup Class: TechnicColorSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicColorSensor

+
+ +
+ +

+ TechnicColorSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicColorSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

ambient

+ + +
+
+ + +
+

Emits when the ambient light changes.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ambient + + +number + + + + +

Percentage, from 0 to 100.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

reflect

+ + +
+
+ + +
+

Emits when the light reflectivity changes.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
reflect + + +number + + + + +

Percentage, from 0 to 100.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicDistanceSensor.html b/docs/TechnicDistanceSensor.html new file mode 100644 index 0000000..611d3ca --- /dev/null +++ b/docs/TechnicDistanceSensor.html @@ -0,0 +1,1646 @@ + + + + + + + node-poweredup Class: TechnicDistanceSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicDistanceSensor

+
+ +
+ +

+ TechnicDistanceSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicDistanceSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

setBrightness(topLeft, bottomLeft, topRight, bottomRight)

+ + +
+
+ + +
+

Set the brightness (or turn on/off) the lights around the eyes.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
topLeft + + +number + + + + +

Top left quadrant (above left eye). 0-100 brightness.

bottomLeft + + +number + + + + +

Bottom left quadrant (below left eye). 0-100 brightness.

topRight + + +number + + + + +

Top right quadrant (above right eye). 0-100 brightness.

bottomRight + + +number + + + + +

Bottom right quadrant (below right eye). 0-100 brightness.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

distance

+ + +
+
+ + +
+

Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm).

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + +

Distance, from 40 to 2500mm

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

fastDistance

+ + +
+
+ + +
+

Emits when the detected distance changes (Fast sampling covers 50mm to 320mm).

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fastDistance + + +number + + + + +

Distance, from 50 to 320mm

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicForceSensor.html b/docs/TechnicForceSensor.html new file mode 100644 index 0000000..18b6c57 --- /dev/null +++ b/docs/TechnicForceSensor.html @@ -0,0 +1,1552 @@ + + + + + + + node-poweredup Class: TechnicForceSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicForceSensor

+
+ +
+ +

+ TechnicForceSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicForceSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

force

+ + +
+
+ + +
+

Emits when force is applied.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
force + + +number + + + + +

Force, in newtons (0-10).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tapped

+ + +
+
+ + +
+

Emits when the sensor is tapped.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tapped + + +number + + + + +

How hard the sensor was tapped, from 0-3.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

touch

+ + +
+
+ + +
+

Emits when the sensor is touched.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
touch + + +boolean + + + + +

Touched on/off (boolean).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicLargeAngularMotor.html b/docs/TechnicLargeAngularMotor.html new file mode 100644 index 0000000..8e6d4e8 --- /dev/null +++ b/docs/TechnicLargeAngularMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicLargeAngularMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicLargeAngularMotor

+
+ +
+ +

+ TechnicLargeAngularMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicLargeAngularMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicLargeLinearMotor.html b/docs/TechnicLargeLinearMotor.html new file mode 100644 index 0000000..da90676 --- /dev/null +++ b/docs/TechnicLargeLinearMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicLargeLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicLargeLinearMotor

+
+ +
+ +

+ TechnicLargeLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicLargeLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumAngularMotor.html b/docs/TechnicMediumAngularMotor.html new file mode 100644 index 0000000..103dd32 --- /dev/null +++ b/docs/TechnicMediumAngularMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicMediumAngularMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumAngularMotor

+
+ +
+ +

+ TechnicMediumAngularMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumAngularMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHub.html b/docs/TechnicMediumHub.html index 9c221df..777a1cb 100644 --- a/docs/TechnicMediumHub.html +++ b/docs/TechnicMediumHub.html @@ -33,14 +33,14 @@ @@ -513,7 +513,7 @@
firmwareVersionhardwareVersion @@ -1409,6 +1409,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + +

setName(name)

@@ -1709,225 +1905,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -2068,178 +2045,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2318,7 +2124,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/TechnicMediumHubAccelerometerSensor.html b/docs/TechnicMediumHubAccelerometerSensor.html new file mode 100644 index 0000000..8fcb059 --- /dev/null +++ b/docs/TechnicMediumHubAccelerometerSensor.html @@ -0,0 +1,1312 @@ + + + + + + + node-poweredup Class: TechnicMediumHubAccelerometerSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHubAccelerometerSensor

+
+ +
+ +

+ TechnicMediumHubAccelerometerSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHubAccelerometerSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

accel

+ + +
+
+ + +
+

Emits when accelerometer detects movement. Measured in mG.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHubGyroSensor.html b/docs/TechnicMediumHubGyroSensor.html new file mode 100644 index 0000000..dce0108 --- /dev/null +++ b/docs/TechnicMediumHubGyroSensor.html @@ -0,0 +1,1312 @@ + + + + + + + node-poweredup Class: TechnicMediumHubGyroSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHubGyroSensor

+
+ +
+ +

+ TechnicMediumHubGyroSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHubGyroSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHubTiltSensor.html b/docs/TechnicMediumHubTiltSensor.html new file mode 100644 index 0000000..507708f --- /dev/null +++ b/docs/TechnicMediumHubTiltSensor.html @@ -0,0 +1,1312 @@ + + + + + + + node-poweredup Class: TechnicMediumHubTiltSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHubTiltSensor

+
+ +
+ +

+ TechnicMediumHubTiltSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHubTiltSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicXLargeLinearMotor.html b/docs/TechnicXLargeLinearMotor.html new file mode 100644 index 0000000..55636fb --- /dev/null +++ b/docs/TechnicXLargeLinearMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicXLargeLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicXLargeLinearMotor

+
+ +
+ +

+ TechnicXLargeLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicXLargeLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TiltSensor.html b/docs/TiltSensor.html new file mode 100644 index 0000000..f079ef9 --- /dev/null +++ b/docs/TiltSensor.html @@ -0,0 +1,1288 @@ + + + + + + + node-poweredup Class: TiltSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TiltSensor

+
+ +
+ +

+ TiltSensor +

+ + +
+ + +
+
+ + +
+
+

new TiltSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TrainMotor.html b/docs/TrainMotor.html new file mode 100644 index 0000000..a3c62cc --- /dev/null +++ b/docs/TrainMotor.html @@ -0,0 +1,1752 @@ + + + + + + + node-poweredup Class: TrainMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TrainMotor

+
+ +
+ +

+ TrainMotor +

+ + +
+ + +
+
+ + +
+
+

new TrainMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time + + +number + + + + +

How long the ramp should last (in milliseconds).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
power + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

stop()

+ + +
+
+ + +
+

Stop the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/VoltageSensor.html b/docs/VoltageSensor.html new file mode 100644 index 0000000..33779a0 --- /dev/null +++ b/docs/VoltageSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: VoltageSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: VoltageSensor

+
+ +
+ +

+ VoltageSensor +

+ + +
+ + +
+
+ + +
+
+

new VoltageSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

voltage

+ + +
+
+ + +
+

Emits when a voltage change is detected.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
voltage + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html index 5479d68..b4f195f 100644 --- a/docs/WeDo2SmartHub.html +++ b/docs/WeDo2SmartHub.html @@ -33,14 +33,14 @@ @@ -501,7 +501,7 @@
firmwareVersionhardwareVersion @@ -1854,7 +1854,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index 5d56af0..d5c59b7 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -33,14 +33,14 @@ @@ -142,27 +142,135 @@

Classes

+
AbsoluteMotor
+
+
BaseHub
+
BasicMotor
+
+ +
BoostMoveHub
+
+ +
ColorDistanceSensor
+
+ +
ControlPlusHub
+
+ +
CurrentSensor
+
+ +
Device
+
+
DuploTrainBase
+
DuploTrainBaseColorSensor
+
+ +
DuploTrainBaseMotor
+
+ +
DuploTrainBaseSpeaker
+
+ +
DuploTraniBaseSpeedometer
+
+
Hub
+
HubLED
+
+ +
Light
+
+
LPF2Hub
+
MediumLinearMotor
+
+ +
MotionSensor
+
+
MoveHub
+
MoveHubMediumLinearMotor
+
+ +
MoveHubTiltSensor
+
+ +
PiezoBuzzer
+
+ +
PUPHub
+
+ +
PUPRemote
+
+
RemoteControl
+
RemoteControlButton
+
+ +
SimpleMediumLinearMotor
+
+ +
TachoMotor
+
+ +
TechnicColorSensor
+
+ +
TechnicDistanceSensor
+
+ +
TechnicForceSensor
+
+ +
TechnicLargeAngularMotor
+
+ +
TechnicLargeLinearMotor
+
+ +
TechnicMediumAngularMotor
+
+
TechnicMediumHub
+
TechnicMediumHubAccelerometerSensor
+
+ +
TechnicMediumHubGyroSensor
+
+ +
TechnicMediumHubTiltSensor
+
+ +
TechnicXLargeLinearMotor
+
+ +
TiltSensor
+
+ +
TrainMotor
+
+ +
VoltageSensor
+
+
WeDo2SmartHub
@@ -200,6 +308,12 @@ +
Type: +object + + +
+ @@ -290,7 +404,722 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -338,6 +1167,12 @@ +
Type: +object + + +
+ @@ -428,7 +1263,7 @@
@@ -476,6 +1311,12 @@ +
Type: +object + + +
+ @@ -590,7 +1431,7 @@ @@ -638,6 +1479,12 @@ +
Type: +object + + +
+ @@ -728,7 +1575,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -776,6 +2185,12 @@ +
Type: +object + + +
+ @@ -866,226 +2281,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1256,178 +2452,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1475,6 +2500,12 @@ +
Type: +object + + +
+ @@ -1565,7 +2596,7 @@
@@ -1613,6 +2644,12 @@ +
Type: +object + + +
+ @@ -1703,226 +2740,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2004,7 +2822,7 @@
-Device +Device @@ -2060,145 +2878,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

attach

- - -
-
- - -
-

Emits when a device is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
device - - -Device - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2369,7 +3049,145 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2484,387 +3302,6 @@ -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - -
@@ -3000,7 +3437,7 @@ @@ -3033,7 +3470,7 @@
-

tilt

+

rotate

@@ -3041,13 +3478,19 @@
-

Emits when a tilt sensor is activated.

+

Emits when a rotation sensor is activated.

+
Type: +object + + +
+ @@ -3076,31 +3519,7 @@
x - - -number - - - - -
yrotation @@ -3135,6 +3554,15 @@ +
Inherited From:
+
+ +
+ @@ -3161,8 +3589,8 @@
@@ -3210,6 +3638,12 @@ +
Type: +object + + +
+ @@ -3300,226 +3734,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -3690,7 +3905,7 @@
@@ -3723,7 +3938,7 @@
-

tilt

+

rotate

@@ -3731,13 +3946,19 @@
-

Emits when a tilt sensor is activated.

+

Emits when a rotation sensor is activated.

+
Type: +object + + +
+ @@ -3766,31 +3987,7 @@
x - - -number - - - - -
yrotation @@ -3829,7 +4026,7 @@
@@ -3860,8 +4057,8 @@
@@ -3909,6 +4106,12 @@ +
Type: +object + + +
+ @@ -4023,7 +4226,7 @@ @@ -4056,7 +4259,7 @@
-

accel

+

attach

@@ -4064,7 +4267,7 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Emits when a device is attached to the Hub.

@@ -4099,85 +4302,13 @@
portdevice -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number +Device @@ -4210,7 +4341,7 @@
@@ -4241,8 +4372,995 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -4413,178 +5531,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -4632,6 +5579,12 @@ +
Type: +object + + +
+ @@ -4722,7 +5675,7 @@
@@ -4770,6 +5723,12 @@ +
Type: +object + + +
+ @@ -4860,7 +5819,7 @@ @@ -4893,7 +5852,7 @@
-

from 0 to 100.

+

ambient

@@ -4908,6 +5867,12 @@ +
Type: +object + + +
+ @@ -4953,7 +5918,7 @@ -

Percentage, from 0 to 100.

Percentage, from 0 to 100.

Distance, from 40 to 2500mm

Distance, from 50 to 320mm

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
touch - - -boolean - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

in newtons (0-10).

+

force

@@ -5736,6 +6587,12 @@ +
Type: +object + + +
+ @@ -5781,7 +6638,7 @@ - +

Force, in newtons (0-10).

@@ -5826,7 +6683,7 @@ @@ -5859,7 +6716,7 @@
-

from 0-3.

+

tapped

@@ -5874,6 +6731,12 @@ +
Type: +object + + +
+ @@ -5919,7 +6782,7 @@ - +

How hard the sensor was tapped, from 0-3.

@@ -5964,7 +6827,7 @@ @@ -5997,7 +6860,7 @@
-

accel

+

touch

@@ -6005,13 +6868,19 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Emits when the sensor is touched.

+
Type: +object + + +
+ @@ -6040,13 +6909,13 @@ - port + touch -string +boolean @@ -6057,62 +6926,134 @@ - +

Touched on/off (boolean).

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -6489,15 +8225,6 @@ -
Inherited From:
-
- -
- @@ -6524,8 +8251,8 @@
@@ -6573,6 +8300,12 @@ +
Type: +object + + +
+ @@ -6711,7 +8444,7 @@ @@ -6759,6 +8492,12 @@ +
Type: +object + + +
+ @@ -6897,7 +8636,481 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + +
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
zabsolute @@ -6151,7 +7092,7 @@
@@ -6182,8 +7123,773 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6354,7 +8060,7 @@
@@ -6387,7 +8093,7 @@
-

tilt

+

accel

@@ -6395,13 +8101,19 @@
-

Emits when a tilt sensor is activated.

+

Emits when accelerometer detects movement. Measured in mG.

+
Type: +object + + +
+ @@ -6471,6 +8183,30 @@ +
z + + +number + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6945,6 +9158,12 @@ +
Type: +object + + +
+ @@ -7035,7 +9254,7 @@
@@ -7276,7 +9495,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_absolutemotor.js.html b/docs/devices_absolutemotor.js.html index b326086..e877cba 100644 --- a/docs/devices_absolutemotor.js.html +++ b/docs/devices_absolutemotor.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tachomotor_1 = require("./tachomotor"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class AbsoluteMotor + * @extends TachoMotor + */ class AbsoluteMotor extends tachomotor_1.TachoMotor { constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) { super(hub, portId, Object.assign({}, modeMap, exports.ModeMap), type); @@ -101,6 +105,7 @@ class AbsoluteMotor extends tachomotor_1.TachoMotor { /** * Emits when a the motors absolute position is changed. * @event AbsoluteMotor#absolute + * @type {object} * @param {number} absolute */ this.notify("absolute", { angle }); @@ -202,7 +207,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_basicmotor.js.html b/docs/devices_basicmotor.js.html index 5a8203b..a3c3a8e 100644 --- a/docs/devices_basicmotor.js.html +++ b/docs/devices_basicmotor.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class BasicMotor + * @extends Device + */ class BasicMotor extends device_1.Device { constructor(hub, portId, modeMap, type = Consts.DeviceType.UNKNOWN) { super(hub, portId, modeMap, type); @@ -97,7 +101,7 @@ class BasicMotor extends device_1.Device { * Set the motor power. * @method BasicMotor#setPower * @param {number} power For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setPower(power, interrupt = true) { if (interrupt) { @@ -129,7 +133,7 @@ class BasicMotor extends device_1.Device { /** * Stop the motor. * @method BasicMotor#stop - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ stop() { this.cancelEventTimer(); @@ -138,7 +142,7 @@ class BasicMotor extends device_1.Device { /** * Brake the motor. * @method BasicMotor#brake - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ brake() { this.cancelEventTimer(); @@ -191,7 +195,7 @@ exports.BasicMotor = BasicMotor; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_colordistancesensor.js.html b/docs/devices_colordistancesensor.js.html index ecbb848..a78c7ff 100644 --- a/docs/devices_colordistancesensor.js.html +++ b/docs/devices_colordistancesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class ColorDistanceSensor + * @extends Device + */ class ColorDistanceSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.COLOR_DISTANCE_SENSOR); @@ -101,6 +105,7 @@ class ColorDistanceSensor extends device_1.Device { /** * Emits when a color sensor is activated. * @event ColorDistanceSensor#color + * @type {object} * @param {Color} color */ this.notify("color", { color }); @@ -115,6 +120,7 @@ class ColorDistanceSensor extends device_1.Device { /** * Emits when a distance sensor is activated. * @event ColorDistanceSensor#distance + * @type {object} * @param {number} distance Distance, in millimeters. */ this.notify("distance", { distance }); @@ -133,6 +139,7 @@ class ColorDistanceSensor extends device_1.Device { /** * A combined color and distance event, emits when the sensor is activated. * @event ColorDistanceSensor#colorAndDistance + * @type {object} * @param {Color} color * @param {number} distance Distance, in millimeters. */ @@ -201,7 +208,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_currentsensor.js.html b/docs/devices_currentsensor.js.html index 1505e38..bae4660 100644 --- a/docs/devices_currentsensor.js.html +++ b/docs/devices_currentsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class CurrentSensor + * @extends Device + */ class CurrentSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.CURRENT_SENSOR); @@ -113,6 +117,7 @@ class CurrentSensor extends device_1.Device { /** * Emits when a current change is detected. * @event CurrentSensor#current + * @type {object} * @param {number} current */ this.notify("current", { current }); @@ -181,7 +186,7 @@ const MaxCurrentRaw = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_device.js.html b/docs/devices_device.js.html new file mode 100644 index 0000000..cba74fb --- /dev/null +++ b/docs/devices_device.js.html @@ -0,0 +1,379 @@ + + + + + + + node-poweredup Source: devices/device.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/device.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const events_1 = require("events");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class Device
+ * @extends EventEmitter
+ */
+class Device extends events_1.EventEmitter {
+    constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) {
+        super();
+        this.autoSubscribe = true;
+        this.values = {};
+        this._busy = false;
+        this._connected = true;
+        this._modeMap = {};
+        this._isVirtualPort = false;
+        this._eventTimer = null;
+        this._hub = hub;
+        this._portId = portId;
+        this._type = type;
+        this._modeMap = modeMap;
+        this._isWeDo2SmartHub = (this.hub.type === Consts.HubType.WEDO2_SMART_HUB);
+        this._isVirtualPort = this.hub.isPortVirtual(portId);
+        const eventAttachListener = (event) => {
+            if (event === "detach") {
+                return;
+            }
+            if (this.autoSubscribe) {
+                if (this._modeMap[event] !== undefined) {
+                    this.subscribe(this._modeMap[event]);
+                }
+            }
+        };
+        const deviceDetachListener = (device) => {
+            if (device.portId === this.portId) {
+                this._connected = false;
+                this.hub.removeListener("detach", deviceDetachListener);
+                this.emit("detach");
+            }
+        };
+        for (const event in this._modeMap) {
+            if (this.hub.listenerCount(event) > 0) {
+                eventAttachListener(event);
+            }
+        }
+        this.hub.on("newListener", eventAttachListener);
+        this.on("newListener", eventAttachListener);
+        this.hub.on("detach", deviceDetachListener);
+    }
+    /**
+     * @readonly
+     * @property {boolean} connected Check if the device is still attached.
+     */
+    get connected() {
+        return this._connected;
+    }
+    /**
+     * @readonly
+     * @property {Hub} hub The Hub the device is attached to.
+     */
+    get hub() {
+        return this._hub;
+    }
+    get portId() {
+        return this._portId;
+    }
+    /**
+     * @readonly
+     * @property {string} portName The port the device is attached to.
+     */
+    get portName() {
+        return this.hub.getPortNameForPortId(this.portId);
+    }
+    /**
+     * @readonly
+     * @property {number} type The type of the device
+     */
+    get type() {
+        return this._type;
+    }
+    get typeName() {
+        return Consts.DeviceTypeNames[this.type];
+    }
+    /**
+     * @readonly
+     * @property {number} mode The mode the device is currently in
+     */
+    get mode() {
+        return this._mode;
+    }
+    get isWeDo2SmartHub() {
+        return this._isWeDo2SmartHub;
+    }
+    /**
+     * @readonly
+     * @property {boolean} isVirtualPort Is this device attached to a virtual port (ie. a combined device)
+     */
+    get isVirtualPort() {
+        return this._isVirtualPort;
+    }
+    writeDirect(mode, data, callback) {
+        if (this.isWeDo2SmartHub) {
+            this.send(Buffer.concat([Buffer.from([this.portId, 0x01, 0x02]), data]), Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
+        }
+        else {
+            this.send(Buffer.concat([Buffer.from([0x81, this.portId, 0x11, 0x51, mode]), data]), Consts.BLECharacteristic.LPF2_ALL, callback);
+        }
+    }
+    send(data, characteristic = Consts.BLECharacteristic.LPF2_ALL, callback) {
+        this._ensureConnected();
+        this.hub.send(data, characteristic, callback);
+    }
+    subscribe(mode) {
+        this._ensureConnected();
+        if (mode !== this._mode) {
+            this._mode = mode;
+            this.hub.subscribe(this.portId, this.type, mode);
+        }
+    }
+    unsubscribe(mode) {
+        this._ensureConnected();
+    }
+    receive(message) {
+        this.notify("receive", { message });
+    }
+    notify(event, values) {
+        this.values[event] = values;
+        this.emit(event, values);
+        if (this.hub.listenerCount(event) > 0) {
+            this.hub.emit(event, this, values);
+        }
+    }
+    finish() {
+        this._busy = false;
+        if (this._finished) {
+            this._finished();
+            this._finished = undefined;
+        }
+    }
+    setEventTimer(timer) {
+        this._eventTimer = timer;
+    }
+    cancelEventTimer() {
+        if (this._eventTimer) {
+            clearTimeout(this._eventTimer);
+            this._eventTimer = null;
+        }
+    }
+    _ensureConnected() {
+        if (!this.connected) {
+            throw new Error("Device is not connected");
+        }
+    }
+}
+exports.Device = Device;
+//# sourceMappingURL=device.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasecolorsensor.js.html b/docs/devices_duplotrainbasecolorsensor.js.html index 8a4df3a..44591a8 100644 --- a/docs/devices_duplotrainbasecolorsensor.js.html +++ b/docs/devices_duplotrainbasecolorsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class DuploTrainBaseColorSensor + * @extends Device + */ class DuploTrainBaseColorSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.DUPLO_TRAIN_BASE_COLOR_SENSOR); @@ -101,6 +105,7 @@ class DuploTrainBaseColorSensor extends device_1.Device { /** * Emits when a color sensor is activated. * @event DuploTrainBaseColorSensor#color + * @type {object} * @param {Color} color */ this.notify("color", { color }); @@ -162,7 +167,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_duplotrainbasemotor.js.html b/docs/devices_duplotrainbasemotor.js.html new file mode 100644 index 0000000..50d36a5 --- /dev/null +++ b/docs/devices_duplotrainbasemotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/duplotrainbasemotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/duplotrainbasemotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class DuploTrainBaseMotor
+ * @extends BasicMotor
+ */
+class DuploTrainBaseMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.DUPLO_TRAIN_BASE_MOTOR);
+    }
+}
+exports.DuploTrainBaseMotor = DuploTrainBaseMotor;
+//# sourceMappingURL=duplotrainbasemotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasespeaker.js.html b/docs/devices_duplotrainbasespeaker.js.html index f7985b8..3c631ee 100644 --- a/docs/devices_duplotrainbasespeaker.js.html +++ b/docs/devices_duplotrainbasespeaker.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class DuploTrainBaseSpeaker + * @extends Device + */ class DuploTrainBaseSpeaker extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.DUPLO_TRAIN_BASE_SPEAKER); @@ -96,7 +100,7 @@ class DuploTrainBaseSpeaker extends device_1.Device { * Play a built-in train sound. * @method DuploTrainBaseSpeaker#playSound * @param {DuploTrainBaseSound} sound - * @returns {Promise} Resolved upon successful issuance of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ playSound(sound) { return new Promise((resolve, reject) => { @@ -156,7 +160,7 @@ var Mode; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_duplotrainbasespeedometer.js.html b/docs/devices_duplotrainbasespeedometer.js.html index 6be089b..37908aa 100644 --- a/docs/devices_duplotrainbasespeedometer.js.html +++ b/docs/devices_duplotrainbasespeedometer.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class DuploTraniBaseSpeedometer + * @extends Device + */ class DuploTrainBaseSpeedometer extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.DUPLO_TRAIN_BASE_SPEEDOMETER); @@ -100,6 +104,7 @@ class DuploTrainBaseSpeedometer extends device_1.Device { /** * Emits on a speed change. * @event DuploTrainBaseSpeedometer#speed + * @type {object} * @param {number} speed */ this.notify("speed", { speed }); @@ -160,7 +165,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_hubled.js.html b/docs/devices_hubled.js.html index 3340263..f98b5c5 100644 --- a/docs/devices_hubled.js.html +++ b/docs/devices_hubled.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class HubLED + * @extends Device + */ class HubLED extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.HUB_LED); @@ -96,7 +100,7 @@ class HubLED extends device_1.Device { * Set the color of the LED on the Hub via a color value. * @method HubLED#setColor * @param {Color} color - * @returns {Promise} Resolved upon successful issuance of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setColor(color) { return new Promise((resolve, reject) => { @@ -120,7 +124,7 @@ class HubLED extends device_1.Device { * @param {number} red * @param {number} green * @param {number} blue - * @returns {Promise} Resolved upon successful issuance of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setRGB(red, green, blue) { return new Promise((resolve, reject) => { @@ -187,7 +191,7 @@ var Mode; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_light.js.html b/docs/devices_light.js.html index 87521bc..1968a20 100644 --- a/docs/devices_light.js.html +++ b/docs/devices_light.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class Light + * @extends Device + */ class Light extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.LIGHT); @@ -173,7 +177,7 @@ exports.Light = Light; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_mediumlinearmotor.js.html b/docs/devices_mediumlinearmotor.js.html new file mode 100644 index 0000000..da4432b --- /dev/null +++ b/docs/devices_mediumlinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/mediumlinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/mediumlinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const tachomotor_1 = require("./tachomotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class MediumLinearMotor
+ * @extends TachoMotor
+ */
+class MediumLinearMotor extends tachomotor_1.TachoMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.MEDIUM_LINEAR_MOTOR);
+    }
+}
+exports.MediumLinearMotor = MediumLinearMotor;
+//# sourceMappingURL=mediumlinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_motionsensor.js.html b/docs/devices_motionsensor.js.html index c4f16b1..6b139e6 100644 --- a/docs/devices_motionsensor.js.html +++ b/docs/devices_motionsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class MotionSensor + * @extends Device + */ class MotionSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.MOTION_SENSOR); @@ -104,6 +108,7 @@ class MotionSensor extends device_1.Device { /** * Emits when a distance sensor is activated. * @event MotionSensor#distance + * @type {object} * @param {number} distance Distance, in millimeters. */ this.notify("distance", { distance }); @@ -164,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_movehubmediumlinearmotor.js.html b/docs/devices_movehubmediumlinearmotor.js.html new file mode 100644 index 0000000..98a5565 --- /dev/null +++ b/docs/devices_movehubmediumlinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/movehubmediumlinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/movehubmediumlinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const tachomotor_1 = require("./tachomotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class MoveHubMediumLinearMotor
+ * @extends TachoMotor
+ */
+class MoveHubMediumLinearMotor extends tachomotor_1.TachoMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR);
+    }
+}
+exports.MoveHubMediumLinearMotor = MoveHubMediumLinearMotor;
+//# sourceMappingURL=movehubmediumlinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_movehubtiltsensor.js.html b/docs/devices_movehubtiltsensor.js.html index c3bdc7c..0ee58b7 100644 --- a/docs/devices_movehubtiltsensor.js.html +++ b/docs/devices_movehubtiltsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class MoveHubTiltSensor + * @extends Device + */ class MoveHubTiltSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.MOVE_HUB_TILT_SENSOR); @@ -99,6 +103,7 @@ class MoveHubTiltSensor extends device_1.Device { /** * Emits when a tilt sensor is activated. * @event MoveHubTiltSensor#tilt + * @type {object} * @param {number} x * @param {number} y */ @@ -162,7 +167,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_piezobuzzer.js.html b/docs/devices_piezobuzzer.js.html index 9edb6bd..846d4d5 100644 --- a/docs/devices_piezobuzzer.js.html +++ b/docs/devices_piezobuzzer.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class PiezoBuzzer + * @extends Device + */ class PiezoBuzzer extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.PIEZO_BUZZER); @@ -155,7 +159,7 @@ exports.PiezoBuzzer = PiezoBuzzer; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_remotecontrolbutton.js.html b/docs/devices_remotecontrolbutton.js.html index db27234..eabf292 100644 --- a/docs/devices_remotecontrolbutton.js.html +++ b/docs/devices_remotecontrolbutton.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class RemoteControlButton + * @extends Device + */ class RemoteControlButton extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.REMOTE_CONTROL_BUTTON); @@ -99,6 +103,7 @@ class RemoteControlButton extends device_1.Device { /** * Emits when a button on the remote is pressed or released. * @event RemoteControlButton#button + * @type {object} * @param {number} event */ const event = message[4]; @@ -166,7 +171,7 @@ exports.ButtonState = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_simplemediumlinearmotor.js.html b/docs/devices_simplemediumlinearmotor.js.html new file mode 100644 index 0000000..1dc20e4 --- /dev/null +++ b/docs/devices_simplemediumlinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/simplemediumlinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/simplemediumlinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class SimpleMediumLinearMotor
+ * @extends Device
+ */
+class SimpleMediumLinearMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.SIMPLE_MEDIUM_LINEAR_MOTOR);
+    }
+}
+exports.SimpleMediumLinearMotor = SimpleMediumLinearMotor;
+//# sourceMappingURL=simplemediumlinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_tachomotor.js.html b/docs/devices_tachomotor.js.html index 1e2ce11..e19b347 100644 --- a/docs/devices_tachomotor.js.html +++ b/docs/devices_tachomotor.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const basicmotor_1 = require("./basicmotor"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class TachoMotor + * @extends BasicMotor + */ class TachoMotor extends basicmotor_1.BasicMotor { constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) { super(hub, portId, Object.assign({}, modeMap, exports.ModeMap), type); @@ -102,12 +106,20 @@ class TachoMotor extends basicmotor_1.BasicMotor { /** * Emits when a rotation sensor is activated. * @event TachoMotor#rotate + * @type {object} * @param {number} rotation */ this.notify("rotate", { degrees }); break; } } + /** + * Set the braking style of the motor. + * + * Note: This applies to setSpeed, rotateByDegrees, and gotoAngle. + * @method TachoMotor#setBrakingStyle + * @param {number} style Either BRAKE or HOLD + */ setBrakingStyle(style) { this._brakeStyle = style; } @@ -115,7 +127,7 @@ class TachoMotor extends basicmotor_1.BasicMotor { * Set the motor speed. * @method TachoMotor#setSpeed * @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setSpeed(speed, time) { if (!this.isVirtualPort && speed instanceof Array) { @@ -242,7 +254,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_techniccolorsensor.js.html b/docs/devices_techniccolorsensor.js.html index 104ed63..603acc6 100644 --- a/docs/devices_techniccolorsensor.js.html +++ b/docs/devices_techniccolorsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicColorSensor + * @extends Device + */ class TechnicColorSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_COLOR_SENSOR); @@ -101,6 +105,7 @@ class TechnicColorSensor extends device_1.Device { /** * Emits when a color sensor is activated. * @event TechnicColorSensor#color + * @type {object} * @param {Color} color */ this.notify("color", { color }); @@ -110,8 +115,9 @@ class TechnicColorSensor extends device_1.Device { const reflect = message[4]; /** * Emits when the light reflectivity changes. - * @event TechnicColorSensor#reflect Percentage, from 0 to 100. - * @param {number} reflect + * @event TechnicColorSensor#reflect + * @type {object} + * @param {number} reflect Percentage, from 0 to 100. */ this.notify("reflect", { reflect }); break; @@ -119,8 +125,9 @@ class TechnicColorSensor extends device_1.Device { const ambient = message[4]; /** * Emits when the ambient light changes. - * @event TechnicColorSensor#ambient Percentage, from 0 to 100. - * @param {number} ambient + * @event TechnicColorSensor#ambient + * @type {object} + * @param {number} ambient Percentage, from 0 to 100. */ this.notify("ambient", { ambient }); break; @@ -184,7 +191,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicdistancesensor.js.html b/docs/devices_technicdistancesensor.js.html index ede059c..525d89a 100644 --- a/docs/devices_technicdistancesensor.js.html +++ b/docs/devices_technicdistancesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicDistanceSensor + * @extends Device + */ class TechnicDistanceSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_DISTANCE_SENSOR); @@ -99,8 +103,9 @@ class TechnicDistanceSensor extends device_1.Device { const distance = message.readUInt16LE(4); /** * Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm). - * @event TechnicDistanceSensor#distance Distance, from 40 to 2500mm - * @param {number} distance + * @event TechnicDistanceSensor#distance + * @type {object} + * @param {number} distance Distance, from 40 to 2500mm */ this.notify("distance", { distance }); break; @@ -108,8 +113,9 @@ class TechnicDistanceSensor extends device_1.Device { const fastDistance = message.readUInt16LE(4); /** * Emits when the detected distance changes (Fast sampling covers 50mm to 320mm). - * @event TechnicDistanceSensor#fastDistance Distance, from 50 to 320mm - * @param {number} fastDistance + * @event TechnicDistanceSensor#fastDistance + * @type {object} + * @param {number} fastDistance Distance, from 50 to 320mm */ this.notify("fastDistance", { fastDistance }); break; @@ -122,7 +128,7 @@ class TechnicDistanceSensor extends device_1.Device { * @param {number} bottomLeft Bottom left quadrant (below left eye). 0-100 brightness. * @param {number} topRight Top right quadrant (above right eye). 0-100 brightness. * @param {number} bottomRight Bottom right quadrant (below right eye). 0-100 brightness. - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setBrightness(topLeft, bottomLeft, topRight, bottomRight) { this.writeDirect(0x05, Buffer.from([topLeft, topRight, bottomLeft, bottomRight])); @@ -183,7 +189,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicforcesensor.js.html b/docs/devices_technicforcesensor.js.html index 3d2c10e..994bb0d 100644 --- a/docs/devices_technicforcesensor.js.html +++ b/docs/devices_technicforcesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicForceSensor + * @extends Device + */ class TechnicForceSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_FORCE_SENSOR); @@ -99,8 +103,9 @@ class TechnicForceSensor extends device_1.Device { const force = message[4] / 10; /** * Emits when force is applied. - * @event TechnicForceSensor#force Force, in newtons (0-10). - * @param {number} force + * @event TechnicForceSensor#force + * @type {object} + * @param {number} force Force, in newtons (0-10). */ this.notify("force", { force }); break; @@ -108,8 +113,9 @@ class TechnicForceSensor extends device_1.Device { const touched = message[4] ? true : false; /** * Emits when the sensor is touched. - * @event TechnicForceSensor#touch Touched on/off (boolean). - * @param {boolean} touch + * @event TechnicForceSensor#touch + * @type {object} + * @param {boolean} touch Touched on/off (boolean). */ this.notify("touched", { touched }); break; @@ -117,8 +123,9 @@ class TechnicForceSensor extends device_1.Device { const tapped = message[4]; /** * Emits when the sensor is tapped. - * @event TechnicForceSensor#tapped How hard the sensor was tapped, from 0-3. - * @param {number} tapped + * @event TechnicForceSensor#tapped + * @type {object} + * @param {number} tapped How hard the sensor was tapped, from 0-3. */ this.notify("tapped", { tapped }); break; @@ -182,7 +189,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_techniclargeangularmotor.js.html b/docs/devices_techniclargeangularmotor.js.html new file mode 100644 index 0000000..0e6571a --- /dev/null +++ b/docs/devices_techniclargeangularmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/techniclargeangularmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/techniclargeangularmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicLargeAngularMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicLargeAngularMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR);
+    }
+}
+exports.TechnicLargeAngularMotor = TechnicLargeAngularMotor;
+//# sourceMappingURL=techniclargeangularmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_techniclargelinearmotor.js.html b/docs/devices_techniclargelinearmotor.js.html new file mode 100644 index 0000000..83ab2d8 --- /dev/null +++ b/docs/devices_techniclargelinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/techniclargelinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/techniclargelinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicLargeLinearMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicLargeLinearMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR);
+    }
+}
+exports.TechnicLargeLinearMotor = TechnicLargeLinearMotor;
+//# sourceMappingURL=techniclargelinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumangularmotor.js.html b/docs/devices_technicmediumangularmotor.js.html new file mode 100644 index 0000000..22a2e71 --- /dev/null +++ b/docs/devices_technicmediumangularmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/technicmediumangularmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicmediumangularmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicMediumAngularMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicMediumAngularMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR);
+    }
+}
+exports.TechnicMediumAngularMotor = TechnicMediumAngularMotor;
+//# sourceMappingURL=technicmediumangularmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumhubaccelerometersensor.js.html b/docs/devices_technicmediumhubaccelerometersensor.js.html index a5b737f..85f89c0 100644 --- a/docs/devices_technicmediumhubaccelerometersensor.js.html +++ b/docs/devices_technicmediumhubaccelerometersensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicMediumHubAccelerometerSensor + * @extends Device + */ class TechnicMediumHubAccelerometerSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER); @@ -98,8 +102,8 @@ class TechnicMediumHubAccelerometerSensor extends device_1.Device { case Mode.ACCEL: /** * Emits when accelerometer detects movement. Measured in mG. - * @event LPF2Hub#accel - * @param {string} port + * @event TechnicMediumHubAccelerometerSensor#accel + * @type {object} * @param {number} x * @param {number} y * @param {number} z @@ -165,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicmediumhubgyrosensor.js.html b/docs/devices_technicmediumhubgyrosensor.js.html index b267432..9ad8e5e 100644 --- a/docs/devices_technicmediumhubgyrosensor.js.html +++ b/docs/devices_technicmediumhubgyrosensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicMediumHubGyroSensor + * @extends Device + */ class TechnicMediumHubGyroSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR); @@ -99,6 +103,7 @@ class TechnicMediumHubGyroSensor extends device_1.Device { /** * Emits when gyroscope detects movement. Measured in DPS - degrees per second. * @event TechnicMediumHubGyroSensor#gyro + * @type {object} * @param {number} x * @param {number} y * @param {number} z @@ -164,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicmediumhubtiltsensor.js.html b/docs/devices_technicmediumhubtiltsensor.js.html index 0453b84..f6bbe48 100644 --- a/docs/devices_technicmediumhubtiltsensor.js.html +++ b/docs/devices_technicmediumhubtiltsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicMediumHubTiltSensor + * @extends Device + */ class TechnicMediumHubTiltSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_TILT_SENSOR); @@ -99,6 +103,7 @@ class TechnicMediumHubTiltSensor extends device_1.Device { /** * Emits when a tilt sensor is activated. * @event TechnicMediumHubTiltSensor#tilt + * @type {object} * @param {number} x * @param {number} y * @param {number} z @@ -164,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicxlargelinearmotor.js.html b/docs/devices_technicxlargelinearmotor.js.html new file mode 100644 index 0000000..b3d40ca --- /dev/null +++ b/docs/devices_technicxlargelinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/technicxlargelinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicxlargelinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicXLargeLinearMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicXLargeLinearMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR);
+    }
+}
+exports.TechnicXLargeLinearMotor = TechnicXLargeLinearMotor;
+//# sourceMappingURL=technicxlargelinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_tiltsensor.js.html b/docs/devices_tiltsensor.js.html index 4c09882..5112b01 100644 --- a/docs/devices_tiltsensor.js.html +++ b/docs/devices_tiltsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TiltSensor + * @extends Device + */ class TiltSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TILT_SENSOR); @@ -100,7 +104,8 @@ class TiltSensor extends device_1.Device { const y = message.readInt8(this.isWeDo2SmartHub ? 3 : 5); /** * Emits when a tilt sensor is activated. - * @event LPF2Hub#tilt + * @event TiltSensor#tilt + * @type {object} * @param {number} x * @param {number} y */ @@ -162,7 +167,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_trainmotor.js.html b/docs/devices_trainmotor.js.html new file mode 100644 index 0000000..6ae8679 --- /dev/null +++ b/docs/devices_trainmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/trainmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/trainmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TrainMotor
+ * @extends BasicMotor
+ */
+class TrainMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TRAIN_MOTOR);
+    }
+}
+exports.TrainMotor = TrainMotor;
+//# sourceMappingURL=trainmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_voltagesensor.js.html b/docs/devices_voltagesensor.js.html index a341a20..e509767 100644 --- a/docs/devices_voltagesensor.js.html +++ b/docs/devices_voltagesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class VoltageSensor + * @extends Device + */ class VoltageSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.VOLTAGE_SENSOR); @@ -113,6 +117,7 @@ class VoltageSensor extends device_1.Device { /** * Emits when a voltage change is detected. * @event VoltageSensor#voltage + * @type {object} * @param {number} voltage */ this.notify("voltage", { voltage }); @@ -185,7 +190,7 @@ const MaxVoltageRaw = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_basehub.js.html b/docs/hubs_basehub.js.html index af7ab7a..910438d 100644 --- a/docs/hubs_basehub.js.html +++ b/docs/hubs_basehub.js.html @@ -33,14 +33,14 @@ @@ -178,7 +178,7 @@ class BaseHub extends events_1.EventEmitter { } /** * @readonly - * @property {string} firmwareVersion Hardware version of the hub + * @property {string} hardwareVersion Hardware version of the hub */ get hardwareVersion() { return this._hardwareVersion; @@ -236,6 +236,12 @@ class BaseHub extends events_1.EventEmitter { disconnect() { return this._bleDevice.disconnect(); } + /** + * Retrieves the device attached to a given port. + * @method Hub#getDeviceAtPort + * @param {string} portName The name of the port to retrieve the device from. + * @returns {Device | undefined} The device attached to the port. + */ getDeviceAtPort(portName) { const portId = this._portMap[portName]; if (portId !== undefined) { @@ -245,6 +251,14 @@ class BaseHub extends events_1.EventEmitter { return undefined; } } + /** + * Retrieves the device attached to a given port, waiting until one is attached if there isn't one. + * + * Note: If a device is never attached, the returned promise may never resolve. + * @method Hub#waitForDeviceAtPort + * @param {string} portName The name of the port to retrieve the device from. + * @returns {Promise} Resolved once a device is attached, or resolved immediately if a device is already attached. + */ waitForDeviceAtPort(portName) { return new Promise((resolve) => { const existingDevice = this.getDeviceAtPort(portName); @@ -262,12 +276,31 @@ class BaseHub extends events_1.EventEmitter { }); }); } + /** + * Retrieves all attached devices. + * @method Hub#getDevices + * @returns {Device[]} Array of all attached devices. + */ getDevices() { return Object.values(this._attachedDevices); } + /** + * Retrieves an array of devices of the specified type. + * @method Hub#getDevicesByType + * @param {number} deviceType The device type to lookup. + * @returns {Device[]} Array of all devices of the specified type. + */ getDevicesByType(deviceType) { return this.getDevices().filter((device) => device.type === deviceType); } + /** + * Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one. + * + * Note: If a device is never attached, the returned promise may never resolve. + * @method Hub#waitForDeviceByType + * @param {number} deviceType The device type to lookup. + * @returns {Promise} Resolved once a device is attached, or resolved immediately if a device is already attached. + */ waitForDeviceByType(deviceType) { return new Promise((resolve) => { const existingDevices = this.getDevicesByType(deviceType); @@ -299,7 +332,7 @@ class BaseHub extends events_1.EventEmitter { /** * Sleep a given amount of time. * - * This is a helper method to make it easier to add delays into a chain of commands. + * Note: This is a helper method to make it easier to add delays into a chain of commands. * @method Hub#sleep * @param {number} delay How long to sleep (in milliseconds). * @returns {Promise} Resolved after the delay is finished. @@ -312,7 +345,7 @@ class BaseHub extends events_1.EventEmitter { /** * Wait until a given list of concurrently running commands are complete. * - * This is a helper method to make it easier to wait for concurrent commands to complete. + * Note: This is a helper method to make it easier to wait for concurrent commands to complete. * @method Hub#wait * @param {Array<Promise<any>>} commands Array of executing commands. * @returns {Promise} Resolved after the commands are finished. @@ -352,7 +385,7 @@ class BaseHub extends events_1.EventEmitter { delete this._attachedDevices[device.portId]; /** * Emits when a device is detached from the Hub. - * @event Hub#attach + * @event Hub#detach * @param {Device} device */ this.emit("detach", device); @@ -449,7 +482,7 @@ exports.BaseHub = BaseHub; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_boostmovehub.js.html b/docs/hubs_boostmovehub.js.html new file mode 100644 index 0000000..c4825ba --- /dev/null +++ b/docs/hubs_boostmovehub.js.html @@ -0,0 +1,276 @@ + + + + + + + node-poweredup Source: hubs/boostmovehub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/boostmovehub.js

+ +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const compare_versions_1 = __importDefault(require("compare-versions"));
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("boostmovehub");
+/**
+ * The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
+ * @class BoostMoveHub
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class BoostMoveHub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.BOOST_MOVE_HUB);
+        this._currentPort = 0x3b;
+        this._voltagePort = 0x3c;
+        this._portNames = {
+            "A": 0,
+            "B": 1,
+            "C": 2,
+            "D": 3,
+            "TILT": 58
+        };
+        debug("Discovered Boost Move Hub");
+    }
+    static IsBoostMoveHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.BOOST_MOVE_HUB_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Boost Move Hub");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+    _checkFirmware(version) {
+        if (compare_versions_1.default("2.0.00.0017", version) === 1) {
+            throw new Error(`Your Boost Move Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
+        }
+    }
+}
+exports.BoostMoveHub = BoostMoveHub;
+//# sourceMappingURL=boostmovehub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_controlplushub.js.html b/docs/hubs_controlplushub.js.html new file mode 100644 index 0000000..0070857 --- /dev/null +++ b/docs/hubs_controlplushub.js.html @@ -0,0 +1,273 @@ + + + + + + + node-poweredup Source: hubs/controlplushub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/controlplushub.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("ControlPlusHub");
+/**
+ * The ControlPlusHub is emitted if the discovered device is a Control+ Hub.
+ * @class ControlPlusHub
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class ControlPlusHub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.CONTROL_PLUS_HUB);
+        this._currentPort = 0x3b;
+        this._currentMaxMA = 4175;
+        this._voltagePort = 0x3c;
+        this._voltageMaxRaw = 4095;
+        this._voltageMaxV = 9.615;
+        this._portNames = {
+            "A": 0,
+            "B": 1,
+            "C": 2,
+            "D": 3,
+            "ACCEL": 97,
+            "GYRO": 98,
+            "TILT": 99
+        };
+        debug("Discovered Control+ Hub");
+    }
+    static IsControlPlusHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.CONTROL_PLUS_LARGE_HUB);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Control+ Hub");
+            await super.connect();
+            this.send(Buffer.from([0x41, 0x3d, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL); // Temperature
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.ControlPlusHub = ControlPlusHub;
+//# sourceMappingURL=controlplushub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_duplotrainbase.js.html b/docs/hubs_duplotrainbase.js.html index 7d4c71b..5d53f26 100644 --- a/docs/hubs_duplotrainbase.js.html +++ b/docs/hubs_duplotrainbase.js.html @@ -33,14 +33,14 @@ @@ -169,7 +169,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_hub.js.html b/docs/hubs_hub.js.html index bf00f19..d02c5d4 100644 --- a/docs/hubs_hub.js.html +++ b/docs/hubs_hub.js.html @@ -33,14 +33,14 @@ @@ -181,7 +181,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_lpf2hub.js.html b/docs/hubs_lpf2hub.js.html index 13d46e8..574986c 100644 --- a/docs/hubs_lpf2hub.js.html +++ b/docs/hubs_lpf2hub.js.html @@ -33,14 +33,14 @@ @@ -164,6 +164,15 @@ class LPF2Hub extends basehub_1.BaseHub { unsubscribe(portId, mode) { this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.LPF2_ALL); } + /** + * Combines two ports with into a single virtual port. + * + * Note: The devices attached to the ports must be of the same device type. + * @method LPF2Hub#createVirtualPort + * @param {string} firstPortName First port name + * @param {string} secondPortName Second port name + * @returns {Promise} Resolved upon successful issuance of command. + */ createVirtualPort(firstPortName, secondPortName) { const firstDevice = this.getDeviceAtPort(firstPortName); if (!firstDevice) { @@ -458,7 +467,7 @@ exports.LPF2Hub = LPF2Hub; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_movehub.js.html b/docs/hubs_movehub.js.html index 8e2433e..6b3ed47 100644 --- a/docs/hubs_movehub.js.html +++ b/docs/hubs_movehub.js.html @@ -33,14 +33,14 @@ @@ -183,7 +183,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_puphub.js.html b/docs/hubs_puphub.js.html new file mode 100644 index 0000000..77b8ee4 --- /dev/null +++ b/docs/hubs_puphub.js.html @@ -0,0 +1,273 @@ + + + + + + + node-poweredup Source: hubs/puphub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/puphub.js

+ +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const compare_versions_1 = __importDefault(require("compare-versions"));
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("puphub");
+/**
+ * The PUPHub is emitted if the discovered device is a Powered UP Hub.
+ * @class PUPHub
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class PUPHub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.POWERED_UP_HUB);
+        this._currentPort = 0x3b;
+        this._voltagePort = 0x3c;
+        this._portNames = {
+            "A": 0,
+            "B": 1
+        };
+        debug("Discovered Powered UP Hub");
+    }
+    static IsPUPHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Powered UP Hub");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+    _checkFirmware(version) {
+        if (compare_versions_1.default("1.1.00.0004", version) === 1) {
+            throw new Error(`Your Powered Up Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
+        }
+    }
+}
+exports.PUPHub = PUPHub;
+//# sourceMappingURL=puphub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_pupremote.js.html b/docs/hubs_pupremote.js.html new file mode 100644 index 0000000..688f36c --- /dev/null +++ b/docs/hubs_pupremote.js.html @@ -0,0 +1,266 @@ + + + + + + + node-poweredup Source: hubs/pupremote.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/pupremote.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("pupremote");
+/**
+ * The PUPRemote is emitted if the discovered device is a Powered UP Remote.
+ * @class PUPRemote
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class PUPRemote extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.POWERED_UP_REMOTE);
+        this._ledPort = 0x34;
+        this._voltagePort = 0x3b;
+        this._voltageMaxV = 6.4;
+        this._voltageMaxRaw = 3200;
+        this._portNames = {
+            "LEFT": 0,
+            "RIGHT": 1
+        };
+        debug("Discovered Powered UP Remote");
+    }
+    static IsPUPRemote(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Powered UP Remote");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.PUPRemote = PUPRemote;
+//# sourceMappingURL=pupremote.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_remotecontrol.js.html b/docs/hubs_remotecontrol.js.html index e46113a..ded1a63 100644 --- a/docs/hubs_remotecontrol.js.html +++ b/docs/hubs_remotecontrol.js.html @@ -33,14 +33,14 @@ @@ -171,7 +171,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_technicmediumhub.js.html b/docs/hubs_technicmediumhub.js.html index b5791f7..3adc0c0 100644 --- a/docs/hubs_technicmediumhub.js.html +++ b/docs/hubs_technicmediumhub.js.html @@ -33,14 +33,14 @@ @@ -177,7 +177,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_wedo2smarthub.js.html b/docs/hubs_wedo2smarthub.js.html index 724ce5e..87aa1ee 100644 --- a/docs/hubs_wedo2smarthub.js.html +++ b/docs/hubs_wedo2smarthub.js.html @@ -33,14 +33,14 @@ @@ -323,7 +323,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/index.html b/docs/index.html index e99f5cd..118bca2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,14 +33,14 @@ @@ -358,7 +358,7 @@ console.log("Scanning for Hubs..."); Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/quicksearch.html b/docs/quicksearch.html index 942391b..95d7143 100644 --- a/docs/quicksearch.html +++ b/docs/quicksearch.html @@ -7,7 +7,7 @@