node-poweredup/docs/quicksearch.html
Nathan Kellenicki 8b16d1012b
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Bumped to 6.1.0
2020-02-24 21:47:06 -08:00

32 lines
455 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
</head>
<body style="background: transparent;">
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/lunr.min.js"></script>
<script src="scripts/fulltext-search.js"></script>
<script type="text/x-docstrap-searchdb">
{"devices_absolutemotor.js.html":{"id":"devices_absolutemotor.js.html","title":"Source: devices/absolutemotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/absolutemotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 &amp;&amp; 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) =&gt; { 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 = () =&gt; { 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 × Search results Close "},"devices_tachomotor.js.html":{"id":"devices_tachomotor.js.html","title":"Source: devices/tachomotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/tachomotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @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; } /** * 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 issuance of the command. */ setSpeed(speed, time) { if (!this.isVirtualPort &amp;&amp; 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) =&gt; { 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 = () =&gt; { 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 &amp;&amp; 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) =&gt; { 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 = () =&gt; { 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 × Search results Close "},"hubs_basehub.js.html":{"id":"hubs_basehub.js.html","title":"Source: hubs/basehub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/basehub.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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\", () =&gt; { /** * 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} hardwareVersion 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) =&gt; { 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(); } /** * 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) { return this._attachedDevices[portId]; } else { 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) =&gt; { const existingDevice = this.getDeviceAtPort(portName); if (existingDevice) { return resolve(existingDevice); } this._attachCallbacks.push((device) =&gt; { if (device.portName === portName) { resolve(device); return true; } else { return false; } }); }); } /** * 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) =&gt; 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) =&gt; { const existingDevices = this.getDevicesByType(deviceType); if (existingDevices.length &gt;= 1) { return resolve(existingDevices[0]); } this._attachCallbacks.push((device) =&gt; { 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) &gt; -1); } /** * Sleep a given amount of time. * * 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. */ sleep(delay) { return new Promise((resolve) =&gt; { global.setTimeout(resolve, delay); }); } /** * Wait until a given list of concurrently running commands are complete. * * Note: This is a helper method to make it easier to wait for concurrent commands to complete. * @method Hub#wait * @param {Array&lt;Promise&lt;any&gt;&gt;} 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#detach * @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 × Search results Close "},"devices_basicmotor.js.html":{"id":"devices_basicmotor.js.html","title":"Source: devices/basicmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/basicmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 issuance of the command. */ setPower(power, interrupt = true) { if (interrupt) { this.cancelEventTimer(); } return new Promise((resolve) =&gt; { 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) =&gt; { utils_1.calculateRamp(this, fromPower, toPower, time) .on(\"changePower\", (power) =&gt; { this.setPower(power, false); }) .on(\"finished\", resolve); }); } /** * Stop the motor. * @method BasicMotor#stop * @returns {Promise} Resolved upon successful issuance of the command. */ stop() { this.cancelEventTimer(); return this.setPower(0); } /** * Brake the motor. * @method BasicMotor#brake * @returns {Promise} Resolved upon successful issuance of the command. */ brake() { this.cancelEventTimer(); return this.setPower(Consts.BrakingStyle.BRAKE); } } exports.BasicMotor = BasicMotor; //# sourceMappingURL=basicmotor.js.map × Search results Close "},"devices_device.js.html":{"id":"devices_device.js.html","title":"Source: devices/device.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/device.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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) =&gt; { if (event === \"detach\") { return; } if (this.autoSubscribe) { if (this._modeMap[event] !== undefined) { this.subscribe(this._modeMap[event]); } } }; const deviceDetachListener = (device) =&gt; { 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) &gt; 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) &gt; 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 × Search results Close "},"hubs_boostmovehub.js.html":{"id":"hubs_boostmovehub.js.html","title":"Source: hubs/boostmovehub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/boostmovehub.js \"use strict\"; var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) { return (mod &amp;&amp; mod.__esModule) ? mod : { \"default\": mod }; }; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.BOOST_MOVE_HUB_ID); } connect() { return new Promise(async (resolve, reject) =&gt; { 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 × Search results Close "},"hubs_lpf2hub.js.html":{"id":"hubs_lpf2hub.js.html","title":"Source: hubs/lpf2hub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/lpf2hub.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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) =&gt; { 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) =&gt; { this.send(Buffer.from([0x02, 0x01]), Consts.BLECharacteristic.LPF2_ALL, () =&gt; { 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 &gt; 14) { throw new Error(\"Name must be 14 characters or less\"); } return new Promise((resolve, reject) =&gt; { 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); } /** * 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) { 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 &lt;= 0) { return; } const len = this._messageBuffer[0]; if (len &gt;= 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 &gt; 0) { this._parseMessage(); } } } _requestHubPropertyValue(property) { return new Promise((resolve) =&gt; { this._propertyRequestCallbacks[property] = (message) =&gt; { 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) =&gt; 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 &lt; message.length; i += 2) { modeCombinationMasks.push(message.readUInt16LE(i)); } modeInfoDebug(`Port ${utils_1.toHex(port)}, mode combinations [${modeCombinationMasks.map((c) =&gt; 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 &lt; 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 × Search results Close "},"devices_colordistancesensor.js.html":{"id":"devices_colordistancesensor.js.html","title":"Source: devices/colordistancesensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/colordistancesensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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] &lt;= 10) { const color = message[this.isWeDo2SmartHub ? 2 : 4]; /** * Emits when a color sensor is activated. * @event ColorDistanceSensor#color * @type {object} * @param {Color} color */ this.notify(\"color\", { color }); } break; case Mode.DISTANCE: if (this.isWeDo2SmartHub) { break; } if (message[4] &lt;= 10) { const distance = Math.floor(message[4] * 25.4) - 20; /** * Emits when a distance sensor is activated. * @event ColorDistanceSensor#distance * @type {object} * @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 &gt; 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 * @type {object} * @param {Color} color * @param {number} distance Distance, in millimeters. */ if (message[4] &lt;= 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 × Search results Close "},"hubs_controlplushub.js.html":{"id":"hubs_controlplushub.js.html","title":"Source: hubs/controlplushub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/controlplushub.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.CONTROL_PLUS_LARGE_HUB); } connect() { return new Promise(async (resolve, reject) =&gt; { 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 × Search results Close "},"devices_currentsensor.js.html":{"id":"devices_currentsensor.js.html","title":"Source: devices/currentsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/currentsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"hubs_duplotrainbase.js.html":{"id":"hubs_duplotrainbase.js.html","title":"Source: hubs/duplotrainbase.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/duplotrainbase.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; 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) =&gt; { 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 × Search results Close "},"devices_duplotrainbasecolorsensor.js.html":{"id":"devices_duplotrainbasecolorsensor.js.html","title":"Source: devices/duplotrainbasecolorsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/duplotrainbasecolorsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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] &lt;= 10) { const color = message[4]; /** * Emits when a color sensor is activated. * @event DuploTrainBaseColorSensor#color * @type {object} * @param {Color} color */ this.notify(\"color\", { color }); } break; case Mode.REFLECTIVITY: const reflect = message[4]; /** * Emits when the light reflectivity changes. * @event DuploTrainBaseColorSensor#reflect * @type {object} * @param {number} reflect Percentage, from 0 to 100. */ this.notify(\"reflect\", { reflect }); break; case Mode.RGB: const red = Math.floor(message.readUInt16LE(4) / 4); const green = Math.floor(message.readUInt16LE(6) / 4); const blue = Math.floor(message.readUInt16LE(8) / 4); /** * Emits when the light reflectivity changes. * @event DuploTrainBaseColorSensor#rgb * @type {object} * @param {number} red * @param {number} green * @param {number} blue */ this.notify(\"rgb\", { red, green, blue }); break; } } } exports.DuploTrainBaseColorSensor = DuploTrainBaseColorSensor; var Mode; (function (Mode) { Mode[Mode[\"COLOR\"] = 0] = \"COLOR\"; Mode[Mode[\"REFLECTIVITY\"] = 2] = \"REFLECTIVITY\"; Mode[Mode[\"RGB\"] = 3] = \"RGB\"; })(Mode = exports.Mode || (exports.Mode = {})); exports.ModeMap = { \"color\": Mode.COLOR, \"reflect\": Mode.REFLECTIVITY, \"rgb\": Mode.RGB }; //# sourceMappingURL=duplotrainbasecolorsensor.js.map × Search results Close "},"devices_duplotrainbasemotor.js.html":{"id":"devices_duplotrainbasemotor.js.html","title":"Source: devices/duplotrainbasemotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/duplotrainbasemotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_duplotrainbasespeaker.js.html":{"id":"devices_duplotrainbasespeaker.js.html","title":"Source: devices/duplotrainbasespeaker.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/duplotrainbasespeaker.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 the command. */ playSound(sound) { return new Promise((resolve, reject) =&gt; { this.subscribe(Mode.SOUND); this.writeDirect(0x01, Buffer.from([sound])); return resolve(); }); } /** * Play a built-in system tone. * @method DuploTrainBaseSpeaker#playTone * @param {number} tone * @returns {Promise} Resolved upon successful issuance of the command. */ playTone(tone) { this.subscribe(Mode.TONE); this.writeDirect(0x02, Buffer.from([tone])); } } exports.DuploTrainBaseSpeaker = DuploTrainBaseSpeaker; var Mode; (function (Mode) { Mode[Mode[\"SOUND\"] = 1] = \"SOUND\"; Mode[Mode[\"TONE\"] = 2] = \"TONE\"; })(Mode = exports.Mode || (exports.Mode = {})); //# sourceMappingURL=duplotrainbasespeaker.js.map × Search results Close "},"devices_duplotrainbasespeedometer.js.html":{"id":"devices_duplotrainbasespeedometer.js.html","title":"Source: devices/duplotrainbasespeedometer.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/duplotrainbasespeedometer.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 DuploTraniBaseSpeedometer * @extends Device */ 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 * @type {object} * @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 × Search results Close "},"hubs_hub.js.html":{"id":"hubs_hub.js.html","title":"Source: hubs/hub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/hub.js \"use strict\"; var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) { return (mod &amp;&amp; mod.__esModule) ? mod : { \"default\": mod }; }; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.HUB_ID); } connect() { return new Promise(async (resolve, reject) =&gt; { 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 × Search results Close "},"devices_hubled.js.html":{"id":"devices_hubled.js.html","title":"Source: devices/hubled.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/hubled.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 the command. */ setColor(color) { return new Promise((resolve, reject) =&gt; { 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 the command. */ setRGB(red, green, blue) { return new Promise((resolve, reject) =&gt; { 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 × Search results Close "},"devices_light.js.html":{"id":"devices_light.js.html","title":"Source: devices/light.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/light.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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) =&gt; { 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) =&gt; { utils_1.calculateRamp(this, fromBrightness, toBrightness, time) .on(\"changePower\", (power) =&gt; { this.setBrightness(power, false); }) .on(\"finished\", resolve); }); } } exports.Light = Light; //# sourceMappingURL=light.js.map × Search results Close "},"devices_mediumlinearmotor.js.html":{"id":"devices_mediumlinearmotor.js.html","title":"Source: devices/mediumlinearmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/mediumlinearmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_motionsensor.js.html":{"id":"devices_motionsensor.js.html","title":"Source: devices/motionsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/motionsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"hubs_movehub.js.html":{"id":"hubs_movehub.js.html","title":"Source: hubs/movehub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/movehub.js \"use strict\"; var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) { return (mod &amp;&amp; mod.__esModule) ? mod : { \"default\": mod }; }; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; 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) =&gt; { 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 × Search results Close "},"devices_movehubmediumlinearmotor.js.html":{"id":"devices_movehubmediumlinearmotor.js.html","title":"Source: devices/movehubmediumlinearmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/movehubmediumlinearmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_movehubtiltsensor.js.html":{"id":"devices_movehubtiltsensor.js.html","title":"Source: devices/movehubtiltsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/movehubtiltsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"devices_piezobuzzer.js.html":{"id":"devices_piezobuzzer.js.html","title":"Source: devices/piezobuzzer.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/piezobuzzer.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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) =&gt; { 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 × Search results Close "},"hubs_puphub.js.html":{"id":"hubs_puphub.js.html","title":"Source: hubs/puphub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/puphub.js \"use strict\"; var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) { return (mod &amp;&amp; mod.__esModule) ? mod : { \"default\": mod }; }; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID); } connect() { return new Promise(async (resolve, reject) =&gt; { 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 × Search results Close "},"hubs_pupremote.js.html":{"id":"hubs_pupremote.js.html","title":"Source: hubs/pupremote.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/pupremote.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID); } connect() { return new Promise(async (resolve, reject) =&gt; { debug(\"Connecting to Powered UP Remote\"); await super.connect(); debug(\"Connect completed\"); return resolve(); }); } } exports.PUPRemote = PUPRemote; //# sourceMappingURL=pupremote.js.map × Search results Close "},"hubs_remotecontrol.js.html":{"id":"hubs_remotecontrol.js.html","title":"Source: hubs/remotecontrol.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/remotecontrol.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; 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) =&gt; { 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 × Search results Close "},"devices_remotecontrolbutton.js.html":{"id":"devices_remotecontrolbutton.js.html","title":"Source: devices/remotecontrolbutton.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/remotecontrolbutton.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"devices_simplemediumlinearmotor.js.html":{"id":"devices_simplemediumlinearmotor.js.html","title":"Source: devices/simplemediumlinearmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/simplemediumlinearmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_techniccolorsensor.js.html":{"id":"devices_techniccolorsensor.js.html","title":"Source: devices/techniccolorsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/techniccolorsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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] &lt;= 10) { const color = message[4]; /** * Emits when a color sensor is activated. * @event TechnicColorSensor#color * @type {object} * @param {Color} color */ this.notify(\"color\", { color }); } break; case Mode.REFLECTIVITY: const reflect = message[4]; /** * Emits when the light reflectivity changes. * @event TechnicColorSensor#reflect * @type {object} * @param {number} reflect Percentage, from 0 to 100. */ this.notify(\"reflect\", { reflect }); break; case Mode.AMBIENT_LIGHT: const ambient = message[4]; /** * Emits when the ambient light changes. * @event TechnicColorSensor#ambient * @type {object} * @param {number} ambient Percentage, from 0 to 100. */ 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 × Search results Close "},"devices_technicdistancesensor.js.html":{"id":"devices_technicdistancesensor.js.html","title":"Source: devices/technicdistancesensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicdistancesensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @param {number} distance Distance, from 40 to 2500mm */ 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 * @type {object} * @param {number} fastDistance Distance, from 50 to 320mm */ 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 issuance of the 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 × Search results Close "},"devices_technicforcesensor.js.html":{"id":"devices_technicforcesensor.js.html","title":"Source: devices/technicforcesensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicforcesensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @param {number} force Force, in newtons (0-10). */ this.notify(\"force\", { force }); break; case Mode.TOUCHED: const touched = message[4] ? true : false; /** * Emits when the sensor is touched. * @event TechnicForceSensor#touch * @type {object} * @param {boolean} touch Touched on/off (boolean). */ this.notify(\"touched\", { touched }); break; case Mode.TAPPED: const tapped = message[4]; /** * Emits when the sensor is tapped. * @event TechnicForceSensor#tapped * @type {object} * @param {number} tapped How hard the sensor was tapped, from 0-3. */ 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 × Search results Close "},"devices_techniclargeangularmotor.js.html":{"id":"devices_techniclargeangularmotor.js.html","title":"Source: devices/techniclargeangularmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/techniclargeangularmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_techniclargelinearmotor.js.html":{"id":"devices_techniclargelinearmotor.js.html","title":"Source: devices/techniclargelinearmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/techniclargelinearmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_technicmediumangularmotor.js.html":{"id":"devices_technicmediumangularmotor.js.html","title":"Source: devices/technicmediumangularmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicmediumangularmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"hubs_technicmediumhub.js.html":{"id":"hubs_technicmediumhub.js.html","title":"Source: hubs/technicmediumhub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/technicmediumhub.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, \"\")) &gt;= 0 &amp;&amp; peripheral.advertisement.manufacturerData &amp;&amp; peripheral.advertisement.manufacturerData.length &gt; 3 &amp;&amp; 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) =&gt; { 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 × Search results Close "},"devices_technicmediumhubaccelerometersensor.js.html":{"id":"devices_technicmediumhubaccelerometersensor.js.html","title":"Source: devices/technicmediumhubaccelerometersensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicmediumhubaccelerometersensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 TechnicMediumHubAccelerometerSensor#accel * @type {object} * @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 × Search results Close "},"devices_technicmediumhubgyrosensor.js.html":{"id":"devices_technicmediumhubgyrosensor.js.html","title":"Source: devices/technicmediumhubgyrosensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicmediumhubgyrosensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"devices_technicmediumhubtiltsensor.js.html":{"id":"devices_technicmediumhubtiltsensor.js.html","title":"Source: devices/technicmediumhubtiltsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicmediumhubtiltsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"devices_technicxlargelinearmotor.js.html":{"id":"devices_technicxlargelinearmotor.js.html","title":"Source: devices/technicxlargelinearmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/technicxlargelinearmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_tiltsensor.js.html":{"id":"devices_tiltsensor.js.html","title":"Source: devices/tiltsensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/tiltsensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 TiltSensor#tilt * @type {object} * @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 × Search results Close "},"devices_trainmotor.js.html":{"id":"devices_trainmotor.js.html","title":"Source: devices/trainmotor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/trainmotor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 × Search results Close "},"devices_voltagesensor.js.html":{"id":"devices_voltagesensor.js.html","title":"Source: devices/voltagesensor.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: devices/voltagesensor.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 */ 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 * @type {object} * @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 × Search results Close "},"hubs_wedo2smarthub.js.html":{"id":"hubs_wedo2smarthub.js.html","title":"Source: hubs/wedo2smarthub.js","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Source: hubs/wedo2smarthub.js \"use strict\"; var __importStar = (this &amp;&amp; this.__importStar) || function (mod) { if (mod &amp;&amp; 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 &amp;&amp; peripheral.advertisement.serviceUuids &amp;&amp; peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.WEDO2_SMART_HUB.replace(/-/g, \"\")) &gt;= 0); } connect() { return new Promise(async (resolve, reject) =&gt; { 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) =&gt; { if (data) { this._parseBatteryMessage(data); } }); } else { this._bleDevice.readFromCharacteristic(\"00002a19-0000-1000-8000-00805f9b34fb\", (err, data) =&gt; { 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) =&gt; { if (data) { this._parseFirmwareRevisionString(data); } }); } else { this._bleDevice.readFromCharacteristic(\"00002a26-0000-1000-8000-00805f9b34fb\", (err, data) =&gt; { if (data) { this._parseFirmwareRevisionString(data); } }); } }); } /** * Shutdown the Hub. * @method WeDo2SmartHub#shutdown * @returns {Promise} Resolved upon successful disconnect. */ shutdown() { return new Promise((resolve, reject) =&gt; { this.send(Buffer.from([0x00]), Consts.BLECharacteristic.WEDO2_DISCONNECT, () =&gt; { 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 &gt; 14) { throw new Error(\"Name must be 14 characters or less\"); } return new Promise((resolve, reject) =&gt; { 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 &lt; 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 × Search results Close "},"classes.list.html":{"id":"classes.list.html","title":"Classes","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Classes 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 Events absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 attach Emits when a device is attached to the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 color Emits when a color sensor is activated. Type: object Parameters: Name Type Description color Color Source: devices/colordistancesensor.js, line 26 colorAndDistance A combined color and distance event, emits when the sensor is activated. Type: object Parameters: Name Type Description color Color distance number Distance, in millimeters. Source: devices/colordistancesensor.js, line 60 distance Emits when a distance sensor is activated. Type: object Parameters: Name Type Description distance number Distance, in millimeters. Source: devices/colordistancesensor.js, line 41 attach Emits when a device is attached to the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 current Emits when a current change is detected. Type: object Parameters: Name Type Description current number Source: devices/currentsensor.js, line 38 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 color Emits when a color sensor is activated. Type: object Parameters: Name Type Description color Color Source: devices/duplotrainbasecolorsensor.js, line 26 reflect Emits when the light reflectivity changes. Type: object Parameters: Name Type Description reflect number Percentage, from 0 to 100. Source: devices/duplotrainbasecolorsensor.js, line 37 rgb Emits when the light reflectivity changes. Type: object Parameters: Name Type Description red number green number blue number Source: devices/duplotrainbasecolorsensor.js, line 49 speed Emits on a speed change. Type: object Parameters: Name Type Description speed number Source: devices/duplotrainbasespeedometer.js, line 25 attach Emits when a device is attached to the Hub. Parameters: Name Type Description device Device Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Source: hubs/basehub.js, line 65 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Source: hubs/lpf2hub.js, line 181 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 distance Emits when a distance sensor is activated. Type: object Parameters: Name Type Description distance number Distance, in millimeters. Source: devices/motionsensor.js, line 29 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 tilt Emits when a tilt sensor is activated. Type: object Parameters: Name Type Description x number y number Source: devices/movehubtiltsensor.js, line 24 attach Emits when a device is attached to the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Overrides: Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 attach Emits when a device is attached to the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Overrides: Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 button Emits when a button on the remote is pressed or released. Type: object Parameters: Name Type Description event number Source: devices/remotecontrolbutton.js, line 24 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Source: devices/tachomotor.js, line 27 ambient Emits when the ambient light changes. Type: object Parameters: Name Type Description ambient number Percentage, from 0 to 100. Source: devices/techniccolorsensor.js, line 47 color Emits when a color sensor is activated. Type: object Parameters: Name Type Description color Color Source: devices/techniccolorsensor.js, line 26 reflect Emits when the light reflectivity changes. Type: object Parameters: Name Type Description reflect number Percentage, from 0 to 100. Source: devices/techniccolorsensor.js, line 37 distance Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm). Type: object Parameters: Name Type Description distance number Distance, from 40 to 2500mm Source: devices/technicdistancesensor.js, line 25 fastDistance Emits when the detected distance changes (Fast sampling covers 50mm to 320mm). Type: object Parameters: Name Type Description fastDistance number Distance, from 50 to 320mm Source: devices/technicdistancesensor.js, line 35 force Emits when force is applied. Type: object Parameters: Name Type Description force number Force, in newtons (0-10). Source: devices/technicforcesensor.js, line 25 tapped Emits when the sensor is tapped. Type: object Parameters: Name Type Description tapped number How hard the sensor was tapped, from 0-3. Source: devices/technicforcesensor.js, line 45 touch Emits when the sensor is touched. Type: object Parameters: Name Type Description touch boolean Touched on/off (boolean). Source: devices/technicforcesensor.js, line 35 absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 accel Emits when accelerometer detects movement. Measured in mG. Type: object Parameters: Name Type Description x number y number z number Source: devices/technicmediumhubaccelerometersensor.js, line 24 gyro Emits when gyroscope detects movement. Measured in DPS - degrees per second. Type: object Parameters: Name Type Description x number y number z number Source: devices/technicmediumhubgyrosensor.js, line 24 tilt Emits when a tilt sensor is activated. Type: object Parameters: Name Type Description x number y number z number Source: devices/technicmediumhubtiltsensor.js, line 24 absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 tilt Emits when a tilt sensor is activated. Type: object Parameters: Name Type Description x number y number Source: devices/tiltsensor.js, line 26 voltage Emits when a voltage change is detected. Type: object Parameters: Name Type Description voltage number Source: devices/voltagesensor.js, line 38 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Source: hubs/wedo2smarthub.js, line 173 × Search results Close "},"index.html":{"id":"index.html","title":"Index","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button node-poweredup - A Javascript module to interface with LEGO Powered Up components. Announcements Important: v6.0.0 is a complete re-architecting of this library. Improvements include proper device and mode support through an external Device object, correct handling of firmware features, and promise-based functionality for interfacing with device attachments. Although many new features were added, existing code will almost surely break upon upgrade. Introduction LEGO Powered Up is the successor to Power Functions, the system for adding electronics to LEGO models. Powered Up is a collection of ranges - starting with LEGO Education WeDo 2.0 released in 2016, LEGO Boost released in 2017, LEGO Powered Up released in 2018, LEGO Technic CONTROL+ released in 2019, and LEGO Education SPIKE Prime released in 2020. It also includes the 2018 Duplo App-Controlled Train sets. This library allows communication and control of Powered Up devices and peripherals via Javascript, both from Node.js and from the browser using Web Bluetooth. Node.js Installation Node.js v8.0+ required. npm install node-poweredup --save node-poweredup uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are certain dependencies which may need installed first. Note: node-poweredup has been tested on macOS 10.15 and Debian/Raspbian on the Raspberry Pi 3 Model B. Compatibility While most Powered Up components and Hubs are compatible with each other, there are exceptions. For example, there is limited backwards compatibility between newer components and the WeDo 2.0 Smart Hub. However WeDo 2.0 components are fully forwards compatible with newer Hubs. Device Name Product Code Type WeDo 2.0 Smart Hub Boost Move Hub Powered Up Hub Control+ Hub Availability WeDo 2.0 Tilt Sensor 45305 Sensor Yes Yes Yes Yes 45300 WeDo 2.0 Motion Sensor 45304 Sensor Yes Yes Yes Yes 45300 WeDo 2.0 Medium Motor 45303 Motor Yes Yes Yes Yes 45300 76112 Boost Color and Distance Sensor 88007 Sensor Partial Yes Yes Yes 17101 Boost Tacho Motor 88008 Motor/Sensor Partial Yes Yes Yes 17101 Powered Up Train Motor 88011 Motor Yes Yes Yes Yes 6019760198 Powered Up LED Lights 88005 Light Yes Yes Yes Yes 88005 Control+ Large Motor 22169 Motor/Sensor Partial No Yes Yes 4209942100 Control+ XLarge Motor 22172 Motor/Sensor Partial No Yes Yes 4209942100 SPIKE Prime Medium Motor 45678 Motor/Sensor Partial Yes Yes Yes 45678 SPIKE Prime Large Motor 45678 Motor/Sensor Partial Yes Yes Yes 45678 SPIKE Prime Color Sensor 45678 Sensor No Yes Yes Yes 45678 SPIKE Prime Distance Sensor 45678 Sensor No Yes Yes Yes 45678 SPIKE Prime Force Sensor 45678 Sensor No Yes Yes Yes 45678 In addition, the Hubs themselves have certain built-in features which this library exposes. Hub Name Product Code Built-In Features Availability WeDo 2.0 Smart hub 45301 RGB LEDPiezo BuzzerButton 45300 Boost Move Hub 88006 RGB LEDTilt Sensor2x Tacho MotorsButton 17101 Powered Up Hub 88009 RGB LEDButton 601976019876112 Powered Up Remote 88010 RGB LEDLeft and Right Control ButtonsButton 6019760198 Duplo Train Base 28743 RGB LED/HeadlightsSpeakerSpeedometerMotorColor and Distance SensorButton 1087410875 Control+ Hub 22127 RGB LEDButtonTilt SensorAccelerometer 4209942100 Known Issues and Limitations The WeDo 2.0 Smart Hub uses an older firmware which is no longer being updated. As a result, only certain motors and sensors work with it. See the table above. When used with the Boost Move Hub, the Control+ Motors do not currently accept commands (This is a known but which requires a firmware update from Lego to fix) The SPIKE Prime Hub does not use Bluetooth Low Energy, so is not supported via this library. It is recommended you use MicroPython and Bluetooth Classic to develop for this Hub. Documentation Full documentation is available here. Node.js Sample Usage const PoweredUP = require(\"node-poweredup\"); const poweredUP = new PoweredUP.PoweredUP(); poweredUP.on(\"discover\", async (hub) =&gt; { // Wait to discover a Hub console.log(`Discovered ${hub.name}!`); await hub.connect(); // Connect to the Hub const motorA = await hub.waitForDeviceAtPort(\"A\"); // Make sure a motor is plugged into port A const motorB = await hub.waitForDeviceAtPort(\"B\"); // Make sure a motor is plugged into port B console.log(\"Connected\"); while (true) { // Repeat indefinitely console.log(\"Running motor B at speed 50\"); motorB.setPower(50); // 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\"); motorA.setPower(100); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop await hub.sleep(2000); motorA.brake(); await hub.sleep(1000); // Do nothing for 1 second console.log(\"Running motor A at speed -30 for 1 second\"); motorA.setPower(-30); // Run a motor attached to port A for 2 seconds at 1/2 speed in reverse (-50) then stop await hub.sleep(2000); motorA.brake(); await hub.sleep(1000); // Do nothing for 1 second } }); poweredUP.scan(); // Start scanning for Hubs console.log(\"Scanning for Hubs...\"); More examples are available in the \"examples\" directory. Credits Thanks go to Jorge Pereira (@JorgePe), Sebastian Raff (@hobbyquaker), Valentin Heun (@vheun), Johan Korten (@jakorten), and Andrey Pokhilko (@undera) for their various works, contributions, and assistance on figuring out the LEGO Boost, WeDo 2.0, and Powered Up protocols. × Search results Close "},"AbsoluteMotor.html":{"id":"AbsoluteMotor.html","title":"Class: AbsoluteMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: AbsoluteMotor AbsoluteMotor new AbsoluteMotor() Source: devices/absolutemotor.js, line 13 Extends TachoMotor Methods gotoAngle(angle [, speed]) Rotate a motor by a given angle. Parameters: Name Type Argument Default Description angle number Absolute position the motor should go to (degrees from 0). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Source: devices/absolutemotor.js, line 39 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: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"BaseHub.html":{"id":"BaseHub.html","title":"Class: BaseHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: BaseHub BaseHub new BaseHub() Source: hubs/basehub.js, line 43 Extends EventEmitter Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Source: hubs/basehub.js, line 118 × Search results Close "},"BasicMotor.html":{"id":"BasicMotor.html","title":"Class: BasicMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: BasicMotor BasicMotor new BasicMotor() Source: devices/basicmotor.js, line 13 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods brake() Brake the motor. Source: devices/basicmotor.js, line 63 Returns: Resolved upon successful issuance of the command. Type Promise rampPower(fromPower, toPower, time) Ramp the motor power. Parameters: Name Type Description 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: devices/basicmotor.js, line 36 Returns: Resolved upon successful completion of command. Type Promise setPower(power) Set the motor power. Parameters: Name Type Description power number For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. Source: devices/basicmotor.js, line 21 Returns: Resolved upon successful issuance of the command. Type Promise stop() Stop the motor. Source: devices/basicmotor.js, line 54 Returns: Resolved upon successful issuance of the command. Type Promise × Search results Close "},"BoostMoveHub.html":{"id":"BoostMoveHub.html","title":"Class: BoostMoveHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: BoostMoveHub BoostMoveHub new BoostMoveHub() The BoostMoveHub is emitted if the discovered device is a Boost Move Hub. Source: hubs/boostmovehub.js, line 18 Extends LPF2Hub Hub Methods connect() Connect to the Hub. Inherited From: Hub#connect Overrides: Hub#connect Source: hubs/basehub.js, line 135 Returns: Resolved upon successful connect. Type Promise 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise disconnect() Disconnect the Hub. Inherited From: Hub#disconnect Source: hubs/basehub.js, line 152 Returns: Resolved upon successful disconnect. Type Promise getDeviceAtPort(portName) Retrieves the device attached to a given port. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#getDeviceAtPort Source: hubs/basehub.js, line 160 Returns: The device attached to the port. Type Device | undefined getDevices() Retrieves all attached devices. Inherited From: Hub#getDevices Source: hubs/basehub.js, line 200 Returns: Array of all attached devices. Type Array.&lt;Device&gt; getDevicesByType(deviceType) Retrieves an array of devices of the specified type. Parameters: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#getDevicesByType Source: hubs/basehub.js, line 208 Returns: Array of all devices of the specified type. Type Array.&lt;Device&gt; setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise sleep(delay) Sleep a given amount of time. Note: This is a helper method to make it easier to add delays into a chain of commands. Parameters: Name Type Description delay number How long to sleep (in milliseconds). Inherited From: Hub#sleep Source: hubs/basehub.js, line 253 Returns: Resolved after the delay is finished. Type Promise wait(commands) Wait until a given list of concurrently running commands are complete. Note: This is a helper method to make it easier to wait for concurrent commands to complete. Parameters: Name Type Description commands Array.&lt;Promise.&lt;any&gt;&gt; Array of executing commands. Inherited From: Hub#wait Source: hubs/basehub.js, line 266 Returns: Resolved after the commands are finished. Type Promise waitForDeviceAtPort(portName) 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. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#waitForDeviceAtPort Source: hubs/basehub.js, line 175 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: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#waitForDeviceByType Source: hubs/basehub.js, line 217 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: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 × Search results Close "},"ColorDistanceSensor.html":{"id":"ColorDistanceSensor.html","title":"Class: ColorDistanceSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: ColorDistanceSensor ColorDistanceSensor new ColorDistanceSensor() Source: devices/colordistancesensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events color Emits when a color sensor is activated. Type: object Parameters: Name Type Description color Color Source: devices/colordistancesensor.js, line 26 colorAndDistance A combined color and distance event, emits when the sensor is activated. Type: object Parameters: Name Type Description color Color distance number Distance, in millimeters. Source: devices/colordistancesensor.js, line 60 distance Emits when a distance sensor is activated. Type: object Parameters: Name Type Description distance number Distance, in millimeters. Source: devices/colordistancesensor.js, line 41 × Search results Close "},"ControlPlusHub.html":{"id":"ControlPlusHub.html","title":"Class: ControlPlusHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: ControlPlusHub ControlPlusHub new ControlPlusHub() The ControlPlusHub is emitted if the discovered device is a Control+ Hub. Source: hubs/controlplushub.js, line 14 Extends LPF2Hub Hub Methods connect() Connect to the Hub. Inherited From: Hub#connect Overrides: Hub#connect Source: hubs/basehub.js, line 135 Returns: Resolved upon successful connect. Type Promise 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise disconnect() Disconnect the Hub. Inherited From: Hub#disconnect Source: hubs/basehub.js, line 152 Returns: Resolved upon successful disconnect. Type Promise getDeviceAtPort(portName) Retrieves the device attached to a given port. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#getDeviceAtPort Source: hubs/basehub.js, line 160 Returns: The device attached to the port. Type Device | undefined getDevices() Retrieves all attached devices. Inherited From: Hub#getDevices Source: hubs/basehub.js, line 200 Returns: Array of all attached devices. Type Array.&lt;Device&gt; getDevicesByType(deviceType) Retrieves an array of devices of the specified type. Parameters: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#getDevicesByType Source: hubs/basehub.js, line 208 Returns: Array of all devices of the specified type. Type Array.&lt;Device&gt; setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise sleep(delay) Sleep a given amount of time. Note: This is a helper method to make it easier to add delays into a chain of commands. Parameters: Name Type Description delay number How long to sleep (in milliseconds). Inherited From: Hub#sleep Source: hubs/basehub.js, line 253 Returns: Resolved after the delay is finished. Type Promise wait(commands) Wait until a given list of concurrently running commands are complete. Note: This is a helper method to make it easier to wait for concurrent commands to complete. Parameters: Name Type Description commands Array.&lt;Promise.&lt;any&gt;&gt; Array of executing commands. Inherited From: Hub#wait Source: hubs/basehub.js, line 266 Returns: Resolved after the commands are finished. Type Promise waitForDeviceAtPort(portName) 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. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#waitForDeviceAtPort Source: hubs/basehub.js, line 175 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: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#waitForDeviceByType Source: hubs/basehub.js, line 217 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: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 × Search results Close "},"CurrentSensor.html":{"id":"CurrentSensor.html","title":"Class: CurrentSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: CurrentSensor CurrentSensor new CurrentSensor() Source: devices/currentsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events current Emits when a current change is detected. Type: object Parameters: Name Type Description current number Source: devices/currentsensor.js, line 38 × Search results Close "},"Device.html":{"id":"Device.html","title":"Class: Device","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: Device Device new Device() Source: devices/device.js, line 12 Extends EventEmitter Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Source: devices/device.js, line 86 × Search results Close "},"DuploTrainBase.html":{"id":"DuploTrainBase.html","title":"Class: DuploTrainBase","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: DuploTrainBase DuploTrainBase new DuploTrainBase() The DuploTrainBase is emitted if the discovered device is a Duplo Train Base. Source: hubs/duplotrainbase.js, line 14 Extends LPF2Hub BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise Events button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 × Search results Close "},"DuploTrainBaseColorSensor.html":{"id":"DuploTrainBaseColorSensor.html","title":"Class: DuploTrainBaseColorSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: DuploTrainBaseColorSensor DuploTrainBaseColorSensor new DuploTrainBaseColorSensor() Source: devices/duplotrainbasecolorsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events color Emits when a color sensor is activated. Type: object Parameters: Name Type Description color Color Source: devices/duplotrainbasecolorsensor.js, line 26 reflect Emits when the light reflectivity changes. Type: object Parameters: Name Type Description reflect number Percentage, from 0 to 100. Source: devices/duplotrainbasecolorsensor.js, line 37 rgb Emits when the light reflectivity changes. Type: object Parameters: Name Type Description red number green number blue number Source: devices/duplotrainbasecolorsensor.js, line 49 × Search results Close "},"DuploTrainBaseMotor.html":{"id":"DuploTrainBaseMotor.html","title":"Class: DuploTrainBaseMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: DuploTrainBaseMotor DuploTrainBaseMotor new DuploTrainBaseMotor() Source: devices/duplotrainbasemotor.js, line 12 Extends BasicMotor Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods brake() Brake the motor. Inherited From: BasicMotor#brake Source: devices/basicmotor.js, line 63 Returns: Resolved upon successful issuance of the command. Type Promise rampPower(fromPower, toPower, time) Ramp the motor power. Parameters: Name Type Description 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: BasicMotor#rampPower Source: devices/basicmotor.js, line 36 Returns: Resolved upon successful completion of command. Type Promise setPower(power) Set the motor power. Parameters: Name Type Description 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: BasicMotor#setPower Source: devices/basicmotor.js, line 21 Returns: Resolved upon successful issuance of the command. Type Promise stop() Stop the motor. Inherited From: BasicMotor#stop Source: devices/basicmotor.js, line 54 Returns: Resolved upon successful issuance of the command. Type Promise × Search results Close "},"DuploTrainBaseSpeaker.html":{"id":"DuploTrainBaseSpeaker.html","title":"Class: DuploTrainBaseSpeaker","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: DuploTrainBaseSpeaker DuploTrainBaseSpeaker new DuploTrainBaseSpeaker() Source: devices/duplotrainbasespeaker.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods playSound(sound) Play a built-in train sound. Parameters: Name Type Description sound DuploTrainBaseSound Source: devices/duplotrainbasespeaker.js, line 20 Returns: Resolved upon successful issuance of the command. Type Promise playTone(tone) Play a built-in system tone. Parameters: Name Type Description tone number Source: devices/duplotrainbasespeaker.js, line 33 Returns: Resolved upon successful issuance of the command. Type Promise × Search results Close "},"DuploTraniBaseSpeedometer.html":{"id":"DuploTraniBaseSpeedometer.html","title":"Class: DuploTraniBaseSpeedometer","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: DuploTraniBaseSpeedometer DuploTraniBaseSpeedometer new DuploTraniBaseSpeedometer() Source: devices/duplotrainbasespeedometer.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 × Search results Close "},"Hub.html":{"id":"Hub.html","title":"Class: Hub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: Hub Hub new Hub() The Hub is emitted if the discovered device is a Hub. Source: hubs/hub.js, line 18 Extends LPF2Hub BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods connect() Connect to the Hub. Source: hubs/basehub.js, line 135 Returns: Resolved upon successful connect. Type Promise 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise disconnect() Disconnect the Hub. Source: hubs/basehub.js, line 152 Returns: Resolved upon successful disconnect. Type Promise getDeviceAtPort(portName) Retrieves the device attached to a given port. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Source: hubs/basehub.js, line 160 Returns: The device attached to the port. Type Device | undefined getDevices() Retrieves all attached devices. Source: hubs/basehub.js, line 200 Returns: Array of all attached devices. Type Array.&lt;Device&gt; getDevicesByType(deviceType) Retrieves an array of devices of the specified type. Parameters: Name Type Description deviceType number The device type to lookup. Source: hubs/basehub.js, line 208 Returns: Array of all devices of the specified type. Type Array.&lt;Device&gt; setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise sleep(delay) Sleep a given amount of time. Note: This is a helper method to make it easier to add delays into a chain of commands. Parameters: Name Type Description delay number How long to sleep (in milliseconds). Source: hubs/basehub.js, line 253 Returns: Resolved after the delay is finished. Type Promise wait(commands) Wait until a given list of concurrently running commands are complete. Note: This is a helper method to make it easier to wait for concurrent commands to complete. Parameters: Name Type Description commands Array.&lt;Promise.&lt;any&gt;&gt; Array of executing commands. Source: hubs/basehub.js, line 266 Returns: Resolved after the commands are finished. Type Promise waitForDeviceAtPort(portName) 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. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Source: hubs/basehub.js, line 175 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: Name Type Description deviceType number The device type to lookup. Source: hubs/basehub.js, line 217 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: Name Type Description device Device Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Source: hubs/basehub.js, line 65 × Search results Close "},"HubLED.html":{"id":"HubLED.html","title":"Class: HubLED","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: HubLED HubLED new HubLED() Source: devices/hubled.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods setColor(color) Set the color of the LED on the Hub via a color value. Parameters: Name Type Description color Color Source: devices/hubled.js, line 20 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: Name Type Description red number green number blue number Source: devices/hubled.js, line 42 Returns: Resolved upon successful issuance of the command. Type Promise × Search results Close "},"Light.html":{"id":"Light.html","title":"Class: Light","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: Light Light new Light() Source: devices/light.js, line 13 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods rampBrightness(fromBrightness, toBrightness, time) Ramp the light brightness. Parameters: Name Type Description 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: devices/light.js, line 36 Returns: Resolved upon successful completion of command. Type Promise setBrightness(brightness) Set the light brightness. Parameters: Name Type Description brightness number Brightness value between 0-100 (0 is off) Source: devices/light.js, line 21 Returns: Resolved upon successful completion of command. Type Promise × Search results Close "},"LPF2Hub.html":{"id":"LPF2Hub.html","title":"Class: LPF2Hub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: LPF2Hub LPF2Hub new LPF2Hub() Source: hubs/lpf2hub.js, line 16 Extends BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods 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: Name Type Description firstPortName string First port name secondPortName string Second port name Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise Events button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Source: hubs/lpf2hub.js, line 181 × Search results Close "},"MediumLinearMotor.html":{"id":"MediumLinearMotor.html","title":"Class: MediumLinearMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: MediumLinearMotor MediumLinearMotor new MediumLinearMotor() Source: devices/mediumlinearmotor.js, line 12 Extends TachoMotor Methods rotateByDegrees(degrees [, speed]) Rotate a motor by a given amount of degrees. Parameters: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"MotionSensor.html":{"id":"MotionSensor.html","title":"Class: MotionSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: MotionSensor MotionSensor new MotionSensor() Source: devices/motionsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events distance Emits when a distance sensor is activated. Type: object Parameters: Name Type Description distance number Distance, in millimeters. Source: devices/motionsensor.js, line 29 × Search results Close "},"MoveHub.html":{"id":"MoveHub.html","title":"Class: MoveHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: MoveHub MoveHub new MoveHub() The MoveHub is emitted if the discovered device is a Move Hub. Source: hubs/movehub.js, line 18 Extends LPF2Hub BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Overrides: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Overrides: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Overrides: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Overrides: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Overrides: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Overrides: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Overrides: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Overrides: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Overrides: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise Events button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 × Search results Close "},"MoveHubMediumLinearMotor.html":{"id":"MoveHubMediumLinearMotor.html","title":"Class: MoveHubMediumLinearMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: MoveHubMediumLinearMotor MoveHubMediumLinearMotor new MoveHubMediumLinearMotor() Source: devices/movehubmediumlinearmotor.js, line 12 Extends TachoMotor Methods rotateByDegrees(degrees [, speed]) Rotate a motor by a given amount of degrees. Parameters: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"MoveHubTiltSensor.html":{"id":"MoveHubTiltSensor.html","title":"Class: MoveHubTiltSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: MoveHubTiltSensor MoveHubTiltSensor new MoveHubTiltSensor() Source: devices/movehubtiltsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events tilt Emits when a tilt sensor is activated. Type: object Parameters: Name Type Description x number y number Source: devices/movehubtiltsensor.js, line 24 × Search results Close "},"PiezoBuzzer.html":{"id":"PiezoBuzzer.html","title":"Class: PiezoBuzzer","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: PiezoBuzzer PiezoBuzzer new PiezoBuzzer() Source: devices/piezobuzzer.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods playTone(frequency, time) Play a tone on the Hub's in-built buzzer Parameters: Name Type Description frequency number time number How long the tone should play for (in milliseconds). Source: devices/piezobuzzer.js, line 20 Returns: Resolved upon successful completion of command (ie. once the tone has finished playing). Type Promise × Search results Close "},"PUPHub.html":{"id":"PUPHub.html","title":"Class: PUPHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: PUPHub PUPHub new PUPHub() The PUPHub is emitted if the discovered device is a Powered UP Hub. Source: hubs/puphub.js, line 18 Extends LPF2Hub Hub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Overrides: Hub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Overrides: Hub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Overrides: Hub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Overrides: Hub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Overrides: Hub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Overrides: Hub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Overrides: Hub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Overrides: Hub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Overrides: Hub#uuid Source: hubs/basehub.js, line 118 Methods connect() Connect to the Hub. Inherited From: Hub#connect Overrides: Hub#connect Source: hubs/basehub.js, line 135 Returns: Resolved upon successful connect. Type Promise 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Overrides: Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise disconnect() Disconnect the Hub. Inherited From: Hub#disconnect Source: hubs/basehub.js, line 152 Returns: Resolved upon successful disconnect. Type Promise getDeviceAtPort(portName) Retrieves the device attached to a given port. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#getDeviceAtPort Source: hubs/basehub.js, line 160 Returns: The device attached to the port. Type Device | undefined getDevices() Retrieves all attached devices. Inherited From: Hub#getDevices Source: hubs/basehub.js, line 200 Returns: Array of all attached devices. Type Array.&lt;Device&gt; getDevicesByType(deviceType) Retrieves an array of devices of the specified type. Parameters: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#getDevicesByType Source: hubs/basehub.js, line 208 Returns: Array of all devices of the specified type. Type Array.&lt;Device&gt; setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Overrides: Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Overrides: Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise sleep(delay) Sleep a given amount of time. Note: This is a helper method to make it easier to add delays into a chain of commands. Parameters: Name Type Description delay number How long to sleep (in milliseconds). Inherited From: Hub#sleep Source: hubs/basehub.js, line 253 Returns: Resolved after the delay is finished. Type Promise wait(commands) Wait until a given list of concurrently running commands are complete. Note: This is a helper method to make it easier to wait for concurrent commands to complete. Parameters: Name Type Description commands Array.&lt;Promise.&lt;any&gt;&gt; Array of executing commands. Inherited From: Hub#wait Source: hubs/basehub.js, line 266 Returns: Resolved after the commands are finished. Type Promise waitForDeviceAtPort(portName) 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. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#waitForDeviceAtPort Source: hubs/basehub.js, line 175 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: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#waitForDeviceByType Source: hubs/basehub.js, line 217 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: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Overrides: Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 × Search results Close "},"PUPRemote.html":{"id":"PUPRemote.html","title":"Class: PUPRemote","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: PUPRemote PUPRemote new PUPRemote() The PUPRemote is emitted if the discovered device is a Powered UP Remote. Source: hubs/pupremote.js, line 14 Extends LPF2Hub Hub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Overrides: Hub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Overrides: Hub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Overrides: Hub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Overrides: Hub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Overrides: Hub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Overrides: Hub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Overrides: Hub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Overrides: Hub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Overrides: Hub#uuid Source: hubs/basehub.js, line 118 Methods connect() Connect to the Hub. Inherited From: Hub#connect Overrides: Hub#connect Source: hubs/basehub.js, line 135 Returns: Resolved upon successful connect. Type Promise 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Overrides: Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise disconnect() Disconnect the Hub. Inherited From: Hub#disconnect Source: hubs/basehub.js, line 152 Returns: Resolved upon successful disconnect. Type Promise getDeviceAtPort(portName) Retrieves the device attached to a given port. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#getDeviceAtPort Source: hubs/basehub.js, line 160 Returns: The device attached to the port. Type Device | undefined getDevices() Retrieves all attached devices. Inherited From: Hub#getDevices Source: hubs/basehub.js, line 200 Returns: Array of all attached devices. Type Array.&lt;Device&gt; getDevicesByType(deviceType) Retrieves an array of devices of the specified type. Parameters: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#getDevicesByType Source: hubs/basehub.js, line 208 Returns: Array of all devices of the specified type. Type Array.&lt;Device&gt; setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Overrides: Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Overrides: Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise sleep(delay) Sleep a given amount of time. Note: This is a helper method to make it easier to add delays into a chain of commands. Parameters: Name Type Description delay number How long to sleep (in milliseconds). Inherited From: Hub#sleep Source: hubs/basehub.js, line 253 Returns: Resolved after the delay is finished. Type Promise wait(commands) Wait until a given list of concurrently running commands are complete. Note: This is a helper method to make it easier to wait for concurrent commands to complete. Parameters: Name Type Description commands Array.&lt;Promise.&lt;any&gt;&gt; Array of executing commands. Inherited From: Hub#wait Source: hubs/basehub.js, line 266 Returns: Resolved after the commands are finished. Type Promise waitForDeviceAtPort(portName) 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. Parameters: Name Type Description portName string The name of the port to retrieve the device from. Inherited From: Hub#waitForDeviceAtPort Source: hubs/basehub.js, line 175 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: Name Type Description deviceType number The device type to lookup. Inherited From: Hub#waitForDeviceByType Source: hubs/basehub.js, line 217 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: Name Type Description device Device Inherited From: Hub#event:attach Source: hubs/basehub.js, line 290 button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Overrides: Hub#event:button Source: hubs/lpf2hub.js, line 181 detach Emits when a device is detached from the Hub. Parameters: Name Type Description device Device Inherited From: Hub#event:detach Source: hubs/basehub.js, line 307 disconnect Emits when the hub is disconnected. Inherited From: Hub#event:disconnect Source: hubs/basehub.js, line 65 × Search results Close "},"RemoteControl.html":{"id":"RemoteControl.html","title":"Class: RemoteControl","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: RemoteControl RemoteControl new RemoteControl() The RemoteControl is emitted if the discovered device is a Remote Control. Source: hubs/remotecontrol.js, line 14 Extends LPF2Hub BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Overrides: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Overrides: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Overrides: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Overrides: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Overrides: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Overrides: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Overrides: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Overrides: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Overrides: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise Events button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 × Search results Close "},"RemoteControlButton.html":{"id":"RemoteControlButton.html","title":"Class: RemoteControlButton","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: RemoteControlButton RemoteControlButton new RemoteControlButton() Source: devices/remotecontrolbutton.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events button Emits when a button on the remote is pressed or released. Type: object Parameters: Name Type Description event number Source: devices/remotecontrolbutton.js, line 24 × Search results Close "},"SimpleMediumLinearMotor.html":{"id":"SimpleMediumLinearMotor.html","title":"Class: SimpleMediumLinearMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: SimpleMediumLinearMotor SimpleMediumLinearMotor new SimpleMediumLinearMotor() Source: devices/simplemediumlinearmotor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 × Search results Close "},"TachoMotor.html":{"id":"TachoMotor.html","title":"Class: TachoMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TachoMotor TachoMotor new TachoMotor() Source: devices/tachomotor.js, line 13 Extends BasicMotor Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods brake() Brake the motor. Inherited From: BasicMotor#brake Source: devices/basicmotor.js, line 63 Returns: Resolved upon successful issuance of the command. Type Promise rampPower(fromPower, toPower, time) Ramp the motor power. Parameters: Name Type Description 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: BasicMotor#rampPower Source: devices/basicmotor.js, line 36 Returns: Resolved upon successful completion of command. Type Promise rotateByDegrees(degrees [, speed]) Rotate a motor by a given amount of degrees. Parameters: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Source: devices/tachomotor.js, line 37 setPower(power) Set the motor power. Parameters: Name Type Description 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: BasicMotor#setPower Source: devices/basicmotor.js, line 21 Returns: Resolved upon successful issuance of the command. Type Promise setSpeed(speed) Set the motor speed. Parameters: Name Type Description speed number For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise stop() Stop the motor. Inherited From: BasicMotor#stop Source: devices/basicmotor.js, line 54 Returns: Resolved upon successful issuance of the command. Type Promise Events rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Source: devices/tachomotor.js, line 27 × Search results Close "},"TechnicColorSensor.html":{"id":"TechnicColorSensor.html","title":"Class: TechnicColorSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicColorSensor TechnicColorSensor new TechnicColorSensor() Source: devices/techniccolorsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events ambient Emits when the ambient light changes. Type: object Parameters: Name Type Description ambient number Percentage, from 0 to 100. Source: devices/techniccolorsensor.js, line 47 color Emits when a color sensor is activated. Type: object Parameters: Name Type Description color Color Source: devices/techniccolorsensor.js, line 26 reflect Emits when the light reflectivity changes. Type: object Parameters: Name Type Description reflect number Percentage, from 0 to 100. Source: devices/techniccolorsensor.js, line 37 × Search results Close "},"TechnicDistanceSensor.html":{"id":"TechnicDistanceSensor.html","title":"Class: TechnicDistanceSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicDistanceSensor TechnicDistanceSensor new TechnicDistanceSensor() Source: devices/technicdistancesensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods setBrightness(topLeft, bottomLeft, topRight, bottomRight) Set the brightness (or turn on/off) the lights around the eyes. Parameters: Name Type Description 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: devices/technicdistancesensor.js, line 45 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: Name Type Description distance number Distance, from 40 to 2500mm Source: devices/technicdistancesensor.js, line 25 fastDistance Emits when the detected distance changes (Fast sampling covers 50mm to 320mm). Type: object Parameters: Name Type Description fastDistance number Distance, from 50 to 320mm Source: devices/technicdistancesensor.js, line 35 × Search results Close "},"TechnicForceSensor.html":{"id":"TechnicForceSensor.html","title":"Class: TechnicForceSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicForceSensor TechnicForceSensor new TechnicForceSensor() Source: devices/technicforcesensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events force Emits when force is applied. Type: object Parameters: Name Type Description force number Force, in newtons (0-10). Source: devices/technicforcesensor.js, line 25 tapped Emits when the sensor is tapped. Type: object Parameters: Name Type Description tapped number How hard the sensor was tapped, from 0-3. Source: devices/technicforcesensor.js, line 45 touch Emits when the sensor is touched. Type: object Parameters: Name Type Description touch boolean Touched on/off (boolean). Source: devices/technicforcesensor.js, line 35 × Search results Close "},"TechnicLargeAngularMotor.html":{"id":"TechnicLargeAngularMotor.html","title":"Class: TechnicLargeAngularMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicLargeAngularMotor TechnicLargeAngularMotor new TechnicLargeAngularMotor() Source: devices/techniclargeangularmotor.js, line 12 Extends AbsoluteMotor Methods gotoAngle(angle [, speed]) Rotate a motor by a given angle. Parameters: Name Type Argument Default Description angle number Absolute position the motor should go to (degrees from 0). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: AbsoluteMotor#gotoAngle Source: devices/absolutemotor.js, line 39 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: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"TechnicLargeLinearMotor.html":{"id":"TechnicLargeLinearMotor.html","title":"Class: TechnicLargeLinearMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicLargeLinearMotor TechnicLargeLinearMotor new TechnicLargeLinearMotor() Source: devices/techniclargelinearmotor.js, line 12 Extends AbsoluteMotor Methods gotoAngle(angle [, speed]) Rotate a motor by a given angle. Parameters: Name Type Argument Default Description angle number Absolute position the motor should go to (degrees from 0). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: AbsoluteMotor#gotoAngle Source: devices/absolutemotor.js, line 39 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: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"TechnicMediumAngularMotor.html":{"id":"TechnicMediumAngularMotor.html","title":"Class: TechnicMediumAngularMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicMediumAngularMotor TechnicMediumAngularMotor new TechnicMediumAngularMotor() Source: devices/technicmediumangularmotor.js, line 12 Extends AbsoluteMotor Methods gotoAngle(angle [, speed]) Rotate a motor by a given angle. Parameters: Name Type Argument Default Description angle number Absolute position the motor should go to (degrees from 0). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: AbsoluteMotor#gotoAngle Source: devices/absolutemotor.js, line 39 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: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"TechnicMediumHub.html":{"id":"TechnicMediumHub.html","title":"Class: TechnicMediumHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicMediumHub TechnicMediumHub new TechnicMediumHub() The TechnicMediumHub is emitted if the discovered device is a Technic Medium Hub. Source: hubs/technicmediumhub.js, line 14 Extends LPF2Hub BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Overrides: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Overrides: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Overrides: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Overrides: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Overrides: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Overrides: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Overrides: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Overrides: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Overrides: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods 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: Name Type Description firstPortName string First port name secondPortName string Second port name Inherited From: LPF2Hub#createVirtualPort Source: hubs/lpf2hub.js, line 88 Returns: Resolved upon successful issuance of command. Type Promise setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Inherited From: LPF2Hub#setName Source: hubs/lpf2hub.js, line 56 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Inherited From: LPF2Hub#shutdown Source: hubs/lpf2hub.js, line 44 Returns: Resolved upon successful disconnect. Type Promise Events button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Inherited From: LPF2Hub#event:button Source: hubs/lpf2hub.js, line 181 × Search results Close "},"TechnicMediumHubAccelerometerSensor.html":{"id":"TechnicMediumHubAccelerometerSensor.html","title":"Class: TechnicMediumHubAccelerometerSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicMediumHubAccelerometerSensor TechnicMediumHubAccelerometerSensor new TechnicMediumHubAccelerometerSensor() Source: devices/technicmediumhubaccelerometersensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events accel Emits when accelerometer detects movement. Measured in mG. Type: object Parameters: Name Type Description x number y number z number Source: devices/technicmediumhubaccelerometersensor.js, line 24 × Search results Close "},"TechnicMediumHubGyroSensor.html":{"id":"TechnicMediumHubGyroSensor.html","title":"Class: TechnicMediumHubGyroSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicMediumHubGyroSensor TechnicMediumHubGyroSensor new TechnicMediumHubGyroSensor() Source: devices/technicmediumhubgyrosensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events gyro Emits when gyroscope detects movement. Measured in DPS - degrees per second. Type: object Parameters: Name Type Description x number y number z number Source: devices/technicmediumhubgyrosensor.js, line 24 × Search results Close "},"TechnicMediumHubTiltSensor.html":{"id":"TechnicMediumHubTiltSensor.html","title":"Class: TechnicMediumHubTiltSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicMediumHubTiltSensor TechnicMediumHubTiltSensor new TechnicMediumHubTiltSensor() Source: devices/technicmediumhubtiltsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events tilt Emits when a tilt sensor is activated. Type: object Parameters: Name Type Description x number y number z number Source: devices/technicmediumhubtiltsensor.js, line 24 × Search results Close "},"TechnicXLargeLinearMotor.html":{"id":"TechnicXLargeLinearMotor.html","title":"Class: TechnicXLargeLinearMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TechnicXLargeLinearMotor TechnicXLargeLinearMotor new TechnicXLargeLinearMotor() Source: devices/technicxlargelinearmotor.js, line 12 Extends AbsoluteMotor Methods gotoAngle(angle [, speed]) Rotate a motor by a given angle. Parameters: Name Type Argument Default Description angle number Absolute position the motor should go to (degrees from 0). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: AbsoluteMotor#gotoAngle Source: devices/absolutemotor.js, line 39 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: Name Type Argument Default Description degrees number How much the motor should be rotated (in degrees). speed number &lt;optional&gt; 100 For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Inherited From: TachoMotor#rotateByDegrees Source: devices/tachomotor.js, line 90 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: Name Type Description style number Either BRAKE or HOLD Inherited From: TachoMotor#setBrakingStyle Source: devices/tachomotor.js, line 37 setSpeed(speed) Set the motor speed. Parameters: Name Type Description 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: TachoMotor#setSpeed Source: devices/tachomotor.js, line 47 Returns: Resolved upon successful issuance of the command. Type Promise Events absolute Emits when a the motors absolute position is changed. Type: object Parameters: Name Type Description absolute number Inherited From: AbsoluteMotor#event:absolute Source: devices/absolutemotor.js, line 26 rotate Emits when a rotation sensor is activated. Type: object Parameters: Name Type Description rotation number Inherited From: TachoMotor#event:rotate Source: devices/tachomotor.js, line 27 × Search results Close "},"TiltSensor.html":{"id":"TiltSensor.html","title":"Class: TiltSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TiltSensor TiltSensor new TiltSensor() Source: devices/tiltsensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events tilt Emits when a tilt sensor is activated. Type: object Parameters: Name Type Description x number y number Source: devices/tiltsensor.js, line 26 × Search results Close "},"TrainMotor.html":{"id":"TrainMotor.html","title":"Class: TrainMotor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: TrainMotor TrainMotor new TrainMotor() Source: devices/trainmotor.js, line 12 Extends BasicMotor Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Methods brake() Brake the motor. Inherited From: BasicMotor#brake Source: devices/basicmotor.js, line 63 Returns: Resolved upon successful issuance of the command. Type Promise rampPower(fromPower, toPower, time) Ramp the motor power. Parameters: Name Type Description 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: BasicMotor#rampPower Source: devices/basicmotor.js, line 36 Returns: Resolved upon successful completion of command. Type Promise setPower(power) Set the motor power. Parameters: Name Type Description 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: BasicMotor#setPower Source: devices/basicmotor.js, line 21 Returns: Resolved upon successful issuance of the command. Type Promise stop() Stop the motor. Inherited From: BasicMotor#stop Source: devices/basicmotor.js, line 54 Returns: Resolved upon successful issuance of the command. Type Promise × Search results Close "},"VoltageSensor.html":{"id":"VoltageSensor.html","title":"Class: VoltageSensor","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: VoltageSensor VoltageSensor new VoltageSensor() Source: devices/voltagesensor.js, line 12 Extends Device Members &lt;readonly&gt; connected Properties: Name Type Description connected boolean Check if the device is still attached. Inherited From: Device#connected Source: devices/device.js, line 62 &lt;readonly&gt; hub Properties: Name Type Description hub Hub The Hub the device is attached to. Inherited From: Device#hub Source: devices/device.js, line 69 &lt;readonly&gt; isVirtualPort Properties: Name Type Description isVirtualPort boolean Is this device attached to a virtual port (ie. a combined device) Inherited From: Device#isVirtualPort Source: devices/device.js, line 106 &lt;readonly&gt; mode Properties: Name Type Description mode number The mode the device is currently in Inherited From: Device#mode Source: devices/device.js, line 96 &lt;readonly&gt; portName Properties: Name Type Description portName string The port the device is attached to. Inherited From: Device#portName Source: devices/device.js, line 79 &lt;readonly&gt; type Properties: Name Type Description type number The type of the device Inherited From: Device#type Source: devices/device.js, line 86 Events voltage Emits when a voltage change is detected. Type: object Parameters: Name Type Description voltage number Source: devices/voltagesensor.js, line 38 × Search results Close "},"WeDo2SmartHub.html":{"id":"WeDo2SmartHub.html","title":"Class: WeDo2SmartHub","body":" node-poweredup Classes AbsoluteMotorBaseHubBasicMotorBoostMoveHubColorDistanceSensorControlPlusHubCurrentSensorDeviceDuploTrainBaseDuploTrainBaseColorSensorDuploTrainBaseMotorDuploTrainBaseSpeakerDuploTraniBaseSpeedometerHubHubLEDLightLPF2HubMediumLinearMotorMotionSensorMoveHubMoveHubMediumLinearMotorMoveHubTiltSensorPiezoBuzzerPUPHubPUPRemoteRemoteControlRemoteControlButtonSimpleMediumLinearMotorTachoMotorTechnicColorSensorTechnicDistanceSensorTechnicForceSensorTechnicLargeAngularMotorTechnicLargeLinearMotorTechnicMediumAngularMotorTechnicMediumHubTechnicMediumHubAccelerometerSensorTechnicMediumHubGyroSensorTechnicMediumHubTiltSensorTechnicXLargeLinearMotorTiltSensorTrainMotorVoltageSensorWeDo2SmartHub Events AbsoluteMotor#event:absoluteAbsoluteMotor#event:rotateBoostMoveHub#event:attachBoostMoveHub#event:buttonBoostMoveHub#event:detachBoostMoveHub#event:disconnectColorDistanceSensor#event:colorColorDistanceSensor#event:colorAndDistanceColorDistanceSensor#event:distanceControlPlusHub#event:attachControlPlusHub#event:buttonControlPlusHub#event:detachControlPlusHub#event:disconnectCurrentSensor#event:currentDuploTrainBase#event:buttonDuploTrainBaseColorSensor#event:colorDuploTrainBaseColorSensor#event:reflectDuploTrainBaseColorSensor#event:rgbDuploTrainBaseSpeedometer#event:speedHub#event:attachHub#event:buttonHub#event:detachHub#event:disconnectLPF2Hub#event:buttonMediumLinearMotor#event:rotateMotionSensor#event:distanceMoveHub#event:buttonMoveHubMediumLinearMotor#event:rotateMoveHubTiltSensor#event:tiltPUPHub#event:attachPUPHub#event:buttonPUPHub#event:detachPUPHub#event:disconnectPUPRemote#event:attachPUPRemote#event:buttonPUPRemote#event:detachPUPRemote#event:disconnectRemoteControl#event:buttonRemoteControlButton#event:buttonTachoMotor#event:rotateTechnicColorSensor#event:ambientTechnicColorSensor#event:colorTechnicColorSensor#event:reflectTechnicDistanceSensor#event:distanceTechnicDistanceSensor#event:fastDistanceTechnicForceSensor#event:forceTechnicForceSensor#event:tappedTechnicForceSensor#event:touchTechnicLargeAngularMotor#event:absoluteTechnicLargeAngularMotor#event:rotateTechnicLargeLinearMotor#event:absoluteTechnicLargeLinearMotor#event:rotateTechnicMediumAngularMotor#event:absoluteTechnicMediumAngularMotor#event:rotateTechnicMediumHub#event:buttonTechnicMediumHubAccelerometerSensor#event:accelTechnicMediumHubGyroSensor#event:gyroTechnicMediumHubTiltSensor#event:tiltTechnicXLargeLinearMotor#event:absoluteTechnicXLargeLinearMotor#event:rotateTiltSensor#event:tiltVoltageSensor#event:voltageWeDo2SmartHub#event:button Class: WeDo2SmartHub WeDo2SmartHub new WeDo2SmartHub() The WeDo2SmartHub is emitted if the discovered device is a WeDo 2.0 Smart Hub. Source: hubs/wedo2smarthub.js, line 15 Extends BaseHub Members &lt;readonly&gt; batteryLevel Properties: Name Type Description batteryLevel number Battery level of the hub (Percentage between 0-100) Inherited From: BaseHub#batteryLevel Source: hubs/basehub.js, line 125 &lt;readonly&gt; firmwareVersion Properties: Name Type Description firmwareVersion string Firmware version of the hub Inherited From: BaseHub#firmwareVersion Source: hubs/basehub.js, line 97 &lt;readonly&gt; hardwareVersion Properties: Name Type Description hardwareVersion string Hardware version of the hub Inherited From: BaseHub#hardwareVersion Source: hubs/basehub.js, line 104 &lt;readonly&gt; name Properties: Name Type Description name string Name of the hub Inherited From: BaseHub#name Source: hubs/basehub.js, line 76 &lt;readonly&gt; ports Properties: Name Type Description ports Array.&lt;string&gt; Array of port names Inherited From: BaseHub#ports Source: hubs/basehub.js, line 90 &lt;readonly&gt; primaryMACAddress Properties: Name Type Description primaryMACAddress string Primary MAC address of the hub Inherited From: BaseHub#primaryMACAddress Source: hubs/basehub.js, line 111 &lt;readonly&gt; rssi Properties: Name Type Description rssi number Signal strength of the hub Inherited From: BaseHub#rssi Source: hubs/basehub.js, line 132 &lt;readonly&gt; type Properties: Name Type Description type string Hub type Inherited From: BaseHub#type Source: hubs/basehub.js, line 83 &lt;readonly&gt; uuid Properties: Name Type Description uuid string UUID of the hub Inherited From: BaseHub#uuid Source: hubs/basehub.js, line 118 Methods setName(name) Set the name of the Hub. Parameters: Name Type Description name string New name of the hub (14 characters or less, ASCII only). Source: hubs/wedo2smarthub.js, line 98 Returns: Resolved upon successful issuance of command. Type Promise shutdown() Shutdown the Hub. Source: hubs/wedo2smarthub.js, line 86 Returns: Resolved upon successful disconnect. Type Promise Events button Emits when a button is pressed. Parameters: Name Type Description button string state ButtonState Source: hubs/wedo2smarthub.js, line 173 × Search results Close "}}
</script>
<script type="text/javascript">
$(document).ready(function() {
Searcher.init();
});
$(window).on("message", function(msg) {
var msgData = msg.originalEvent.data;
if (msgData.msgid != "docstrap.quicksearch.start") {
return;
}
var results = Searcher.search(msgData.searchTerms);
window.parent.postMessage({"results": results, "msgid": "docstrap.quicksearch.done"}, "*");
});
</script>
</body>
</html>