diff --git a/README.md b/README.md index 2c86c9a..3bc745b 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ ### 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 WeDo 2.0 released in 2016, LEGO Boost released in 2017, LEGO Powered Up released in 2018, and LEGO Technic CONTROL+ released in 2019. It also includes the 2018 Duplo App-Controlled Train sets. +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. +Node.js v8.0+ required. ```javascript npm install node-poweredup --save @@ -19,7 +19,7 @@ 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](https://github.com/noble/noble#prerequisites). -Note: node-poweredup has been tested on macOS 10.13 and Debian/Raspbian on the Raspberry Pi 3 Model B. +Note: node-poweredup has been tested on macOS 10.15 and Debian/Raspbian on the Raspberry Pi 3 Model B. ### Compatibility @@ -36,6 +36,12 @@ While most Powered Up components and Hubs are compatible with each other, there | Powered Up LED Lights | 88005 | Light | Yes | Yes | Yes | Yes | 88005 | | Control+ Large Motor | 22169 | Motor/Sensor | *Partial* | No | Yes | Yes | 42099
42100 | | Control+ XLarge Motor | 22172 | Motor/Sensor | *Partial* | No | Yes | Yes | 42099
42100 | +| 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 | Motor/Sensor | *Partial* | Yes | Yes | Yes | 45678 | +| SPIKE Prime Distance Sensor | 45678 | Motor/Sensor | *Partial* | Yes | Yes | Yes | 45678 | +| SPIKE Prime Force Sensor | 45678 | Motor/Sensor | *Partial* | Yes | Yes | Yes | 45678 | + In addition, the Hubs themselves have certain built-in features which this library exposes. @@ -56,6 +62,8 @@ In addition, the Hubs themselves have certain built-in features which this libra * When used with the Boost Move Hub, the Control+ Motors do not currently accept commands. +* 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.](https://nathankellenicki.github.io/node-poweredup/) diff --git a/docs/AbsoluteMotor.html b/docs/AbsoluteMotor.html new file mode 100644 index 0000000..b908a8e --- /dev/null +++ b/docs/AbsoluteMotor.html @@ -0,0 +1,1413 @@ + + + + + + + node-poweredup Class: AbsoluteMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: AbsoluteMotor

+
+ +
+ +

+ AbsoluteMotor +

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

new AbsoluteMotor()

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

Extends

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

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

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

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

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

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

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

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

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

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

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

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

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

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

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

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

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

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

Resolved upon successful issuance of the command.

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

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/BaseHub.html b/docs/BaseHub.html index b582d8f..6edd204 100644 --- a/docs/BaseHub.html +++ b/docs/BaseHub.html @@ -33,14 +33,14 @@ @@ -479,7 +479,7 @@ - firmwareVersion + hardwareVersion @@ -1325,7 +1325,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/BasicMotor.html b/docs/BasicMotor.html new file mode 100644 index 0000000..9757e33 --- /dev/null +++ b/docs/BasicMotor.html @@ -0,0 +1,1716 @@ + + + + + + + node-poweredup Class: BasicMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: BasicMotor

+
+ +
+ +

+ BasicMotor +

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

new BasicMotor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

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

Resolved upon successful issuance of the command.

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

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

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

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

toPower + + +number + + + + +

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

time + + +number + + + + +

How long the ramp should last (in milliseconds).

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

Resolved upon successful completion of command.

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

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

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

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

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

Resolved upon successful issuance of the command.

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

stop()

+ + +
+
+ + +
+

Stop the motor.

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

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/BoostMoveHub.html b/docs/BoostMoveHub.html index 739b94c..bc48e58 100644 --- a/docs/BoostMoveHub.html +++ b/docs/BoostMoveHub.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -209,1375 +202,12 @@ -

Members

- -
- -
-
-

<readonly> batteryLevel

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

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

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

<readonly> current

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

Current usage of the hub (Milliamps)

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

<readonly> firmwareVersion

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

Firmware version of the hub

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

<readonly> hardwareVersion

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

Hardware version of the hub

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

<readonly> name

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

Name of the hub

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

<readonly> primaryMACAddress

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

Primary MAC address of the hub

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

<readonly> rssi

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

Signal strength of the hub

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

<readonly> uuid

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

UUID of the hub

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

<readonly> voltage

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

Voltage of the hub (Volts)

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

Methods

-
-
-

brakeMotor(port)

- - -
-
- - -
-

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

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

Resolved upon successful completion of command.

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

connect()

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

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

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

getHubType()

+

getDeviceAtPort(portName)

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

Get the hub type.

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

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

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

The name of the port to retrieve the device from.

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

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

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

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

toSpeed - - -number - - - - -

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

time - - -number - - - - -

How long the ramp should last (in milliseconds).

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

Resolved upon successful completion of command.

+

The device attached to the port.

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

resetAbsolutePosition(port)

- - -
-
- - -
-

Reset the current motor position as absolute position zero

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

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

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

setAbsolutePosition(port, pos [, speed])

- - -
-
- - -
-

Tell motor to goto an absolute position

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

The position of the motor to go to

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

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

+
+ + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

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

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

+

Array of all attached devices.

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

setLEDColor(color)

+

getDevicesByType(deviceType)

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

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

+

Retrieves an array of devices of the specified type.

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

The device type to lookup.

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

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

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

setLEDRGB(red, green, blue)

- - -
-
- - -
-

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

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

Resolved upon successful issuance of command.

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

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

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

Brightness value between 0-100 (0 is off)

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

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

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

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

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

setMotorAngle(port, angle [, speed])

- - -
-
- - -
-

Rotate a motor by a given angle.

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

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

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

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

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

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

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

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

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

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

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

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

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

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

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

Sleep a given amount of time.

-

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

+

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

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

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

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

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

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

Resolved upon successful issuance of command.

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

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

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

Resolved upon successful issuance of command.

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

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

-

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

+

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

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

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

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

Emits when accelerometer detects movement. Measured in mG.

+

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

+

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

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

The name of the port to retrieve the device from.

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

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

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

attach

+

waitForDeviceByType(deviceType)

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

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

+

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

+

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

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

The device type to lookup.

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

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

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

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

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

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

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

color

- - -
-
- - -
-

Emits when a color sensor is activated.

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

colorAndDistance

- - -
-
- - -
-

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

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

Distance, in millimeters.

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

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

+

Emits when a device is detached from the Hub.

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

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

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

Distance, in millimeters.

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

gyro

- - -
-
- - -
-

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

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

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

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

speed

- - -
-
- - -
-

Emits on a speed change.

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

temp

- - -
-
- - -
-

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

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

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

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

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

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

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

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

(Only available when using a Control+ Hub)

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

Class: ColorDistanceSensor

+
+ +
+ +

+ ColorDistanceSensor +

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

new ColorDistanceSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

colorAndDistance

+ + +
+
+ + +
+

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

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
distance + + +number + + + + +

Distance, in millimeters.

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

distance

+ + +
+
+ + +
+

Emits when a distance sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + +

Distance, in millimeters.

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

Members

- -
- -
-
-

<readonly> batteryLevel

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

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

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

<readonly> current

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

Current usage of the hub (Milliamps)

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

<readonly> firmwareVersion

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

Firmware version of the hub

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

<readonly> hardwareVersion

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

Hardware version of the hub

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

<readonly> name

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

Name of the hub

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

<readonly> primaryMACAddress

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

Primary MAC address of the hub

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

<readonly> rssi

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

Signal strength of the hub

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

<readonly> uuid

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

UUID of the hub

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

<readonly> voltage

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

Voltage of the hub (Volts)

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

Methods

-
-
-

brakeMotor(port)

- - -
-
- - -
-

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

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

Resolved upon successful completion of command.

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

connect()

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

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

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

getHubType()

+

getDeviceAtPort(portName)

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

Get the hub type.

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

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1997,7 +696,7 @@
portportName @@ -2014,7 +713,7 @@ -

The name of the port to retrieve the device from.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
fromSpeed - - -number - - - - -

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

toSpeed - - -number - - - - -

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

time - - -number - - - - -

How long the ramp should last (in milliseconds).

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

Resolved upon successful completion of command.

+

The device attached to the port.

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

resetAbsolutePosition(port)

- - -
-
- - -
-

Reset the current motor position as absolute position zero

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

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

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

setAbsolutePosition(port, pos [, speed])

- - -
-
- - -
-

Tell motor to goto an absolute position

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

The position of the motor to go to

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

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

+
+ + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

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

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

+

Array of all attached devices.

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

setLEDColor(color)

+

getDevicesByType(deviceType)

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

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

+

Retrieves an array of devices of the specified type.

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

The device type to lookup.

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

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

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

setLEDRGB(red, green, blue)

- - -
-
- - -
-

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

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

Resolved upon successful issuance of command.

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

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

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

Brightness value between 0-100 (0 is off)

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

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

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

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

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

setMotorAngle(port, angle [, speed])

- - -
-
- - -
-

Rotate a motor by a given angle.

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

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

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

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

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

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

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

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

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

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

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

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

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

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

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

Sleep a given amount of time.

-

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

+

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

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

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

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

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

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

Resolved upon successful issuance of command.

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

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

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

Resolved upon successful issuance of command.

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

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

-

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

+

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

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

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

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

Emits when accelerometer detects movement. Measured in mG.

+

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

+

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

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

The name of the port to retrieve the device from.

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

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

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

attach

+

waitForDeviceByType(deviceType)

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

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

+

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

+

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

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

The device type to lookup.

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

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

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

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2366,15 +2922,6 @@ -
Inherited From:
-
- -
- @@ -2401,8 +2948,8 @@
@@ -2427,12 +2974,207 @@ +
Returns:
+ + +
+

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

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

waitForDeviceByType(deviceType)

+ + +
+
+ + +
+

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

+

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

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

color

- - -
-
- - -
-

Emits when a color sensor is activated.

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

colorAndDistance

- - -
-
- - -
-

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

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

Distance, in millimeters.

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

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

+

Emits when a device is detached from the Hub.

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

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

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

Distance, in millimeters.

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

gyro

- - -
-
- - -
-

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

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

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

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

speed

- - -
-
- - -
-

Emits on a speed change.

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

temp

- - -
-
- - -
-

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

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

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

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

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

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

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

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

(Only available when using a Control+ Hub)

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

Class: CurrentSensor

+
+ +
+ +

+ CurrentSensor +

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

new CurrentSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

current

+ + +
+
+ + +
+

Emits when a current change is detected.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
current + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Device.html b/docs/Device.html new file mode 100644 index 0000000..015810e --- /dev/null +++ b/docs/Device.html @@ -0,0 +1,1062 @@ + + + + + + + node-poweredup Class: Device + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: Device

+
+ +
+ +

+ Device +

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

new Device()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBase.html b/docs/DuploTrainBase.html index 48883ed..c00f748 100644 --- a/docs/DuploTrainBase.html +++ b/docs/DuploTrainBase.html @@ -33,14 +33,14 @@ @@ -503,7 +503,7 @@
firmwareVersionhardwareVersion @@ -1364,6 +1364,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

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

setName(name)

@@ -1664,225 +1860,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

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

button

@@ -2023,178 +2000,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2273,7 +2079,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/DuploTrainBaseColorSensor.html b/docs/DuploTrainBaseColorSensor.html new file mode 100644 index 0000000..9cdafe9 --- /dev/null +++ b/docs/DuploTrainBaseColorSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: DuploTrainBaseColorSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTrainBaseColorSensor

+
+ +
+ +

+ DuploTrainBaseColorSensor +

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

new DuploTrainBaseColorSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBaseMotor.html b/docs/DuploTrainBaseMotor.html new file mode 100644 index 0000000..a3b6dba --- /dev/null +++ b/docs/DuploTrainBaseMotor.html @@ -0,0 +1,1752 @@ + + + + + + + node-poweredup Class: DuploTrainBaseMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTrainBaseMotor

+
+ +
+ +

+ DuploTrainBaseMotor +

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

new DuploTrainBaseMotor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

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

Resolved upon successful issuance of the command.

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

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

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

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

toPower + + +number + + + + +

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

time + + +number + + + + +

How long the ramp should last (in milliseconds).

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

Resolved upon successful completion of command.

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

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

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

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

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

Resolved upon successful issuance of the command.

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

stop()

+ + +
+
+ + +
+

Stop the motor.

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

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTrainBaseSpeaker.html b/docs/DuploTrainBaseSpeaker.html new file mode 100644 index 0000000..618b18d --- /dev/null +++ b/docs/DuploTrainBaseSpeaker.html @@ -0,0 +1,1282 @@ + + + + + + + node-poweredup Class: DuploTrainBaseSpeaker + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTrainBaseSpeaker

+
+ +
+ +

+ DuploTrainBaseSpeaker +

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

new DuploTrainBaseSpeaker()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

playSound(sound)

+ + +
+
+ + +
+

Play a built-in train sound.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sound + + +DuploTrainBaseSound + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/DuploTraniBaseSpeedometer.html b/docs/DuploTraniBaseSpeedometer.html new file mode 100644 index 0000000..f2a4418 --- /dev/null +++ b/docs/DuploTraniBaseSpeedometer.html @@ -0,0 +1,1116 @@ + + + + + + + node-poweredup Class: DuploTraniBaseSpeedometer + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DuploTraniBaseSpeedometer

+
+ +
+ +

+ DuploTraniBaseSpeedometer +

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

new DuploTraniBaseSpeedometer()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Hub.html b/docs/Hub.html index 1999914..e9f93d3 100644 --- a/docs/Hub.html +++ b/docs/Hub.html @@ -33,14 +33,14 @@ @@ -503,7 +503,7 @@
firmwareVersionhardwareVersion @@ -1472,6 +1472,202 @@ + + + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1584,6 +1780,445 @@ + + + + +
+
+

getDeviceAtPort(portName)

+ + +
+
+ + +
+

Retrieves the device attached to a given port.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The name of the port to retrieve the device from.

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

The device attached to the port.

+
+ + + +
+
+ Type +
+
+ +Device +| + +undefined + + + +
+
+ + + + + +
+ + + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

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

Array of all attached devices.

+
+ + + +
+
+ Type +
+
+ +Array.<Device> + + + +
+
+ + + + + +
+ + + +
+
+

getDevicesByType(deviceType)

+ + +
+
+ + +
+

Retrieves an array of devices of the specified type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
deviceType + + +number + + + + +

The device type to lookup.

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

Array of all devices of the specified type.

+
+ + + +
+
+ Type +
+
+ +Array.<Device> + + + +
+
+ + + + +
@@ -1891,7 +2526,7 @@

Sleep a given amount of time.

-

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

+

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

@@ -1988,7 +2623,7 @@ @@ -2054,7 +2689,7 @@

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

-

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

+

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

@@ -2151,7 +2786,7 @@ @@ -2204,19 +2839,11 @@ - - - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -2224,7 +2851,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

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

+

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

@@ -2259,7 +2887,7 @@
portportName @@ -2276,79 +2904,7 @@ -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -

The name of the port to retrieve the device from.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
deviceType + + +number + + + + +

The device type to lookup.

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

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

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

Events

+ +
+

attach

@@ -2484,7 +3226,7 @@ -Device +Device @@ -2540,145 +3282,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

attach

- - -
-
- - -
-

Emits when a device is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
device - - -Device - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2849,7 +3453,145 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2964,177 +3706,6 @@ -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - -
@@ -3187,7 +3758,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/HubLED.html b/docs/HubLED.html new file mode 100644 index 0000000..5c68025 --- /dev/null +++ b/docs/HubLED.html @@ -0,0 +1,1492 @@ + + + + + + + node-poweredup Class: HubLED + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: HubLED

+
+ +
+ +

+ HubLED +

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

new HubLED()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

setColor(color)

+ + +
+
+ + +
+

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

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

Resolved upon successful issuance of the command.

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

setRGB(red, green, blue)

+ + +
+
+ + +
+

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

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

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/LPF2Hub.html b/docs/LPF2Hub.html index 9a8d0b4..0410915 100644 --- a/docs/LPF2Hub.html +++ b/docs/LPF2Hub.html @@ -33,14 +33,14 @@ @@ -497,7 +497,7 @@ - firmwareVersion + hardwareVersion @@ -1358,6 +1358,193 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

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

setName(name)

@@ -1640,216 +1827,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

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

button

@@ -1981,169 +1958,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2222,7 +2037,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/Light.html b/docs/Light.html new file mode 100644 index 0000000..5314026 --- /dev/null +++ b/docs/Light.html @@ -0,0 +1,1492 @@ + + + + + + + node-poweredup Class: Light + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: Light

+
+ +
+ +

+ Light +

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

new Light()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

rampBrightness(fromBrightness, toBrightness, time)

+ + +
+
+ + +
+

Ramp the light brightness.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromBrightness + + +number + + + + +

Brightness value between 0-100 (0 is off)

toBrightness + + +number + + + + +

Brightness value between 0-100 (0 is off)

time + + +number + + + + +

How long the ramp should last (in milliseconds).

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

Resolved upon successful completion of command.

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

setBrightness(brightness)

+ + +
+
+ + +
+

Set the light brightness.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
brightness + + +number + + + + +

Brightness value between 0-100 (0 is off)

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

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MediumLinearMotor.html b/docs/MediumLinearMotor.html new file mode 100644 index 0000000..4e32bc7 --- /dev/null +++ b/docs/MediumLinearMotor.html @@ -0,0 +1,1051 @@ + + + + + + + node-poweredup Class: MediumLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MediumLinearMotor

+
+ +
+ +

+ MediumLinearMotor +

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

new MediumLinearMotor()

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

Extends

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

Methods

+ +
+ +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

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

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

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

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

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

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

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

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

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

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

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

Resolved upon successful issuance of the command.

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

Events

+ +
+ +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MotionSensor.html b/docs/MotionSensor.html new file mode 100644 index 0000000..7601a20 --- /dev/null +++ b/docs/MotionSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: MotionSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MotionSensor

+
+ +
+ +

+ MotionSensor +

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

new MotionSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

distance

+ + +
+
+ + +
+

Emits when a distance sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + +

Distance, in millimeters.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MoveHub.html b/docs/MoveHub.html index 1dc1a1f..a454da0 100644 --- a/docs/MoveHub.html +++ b/docs/MoveHub.html @@ -33,14 +33,14 @@ @@ -513,7 +513,7 @@ - firmwareVersion + hardwareVersion @@ -1409,6 +1409,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

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

setName(name)

@@ -1709,225 +1905,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

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

button

@@ -2068,178 +2045,7 @@ -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2318,7 +2124,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/MoveHubMediumLinearMotor.html b/docs/MoveHubMediumLinearMotor.html new file mode 100644 index 0000000..295c052 --- /dev/null +++ b/docs/MoveHubMediumLinearMotor.html @@ -0,0 +1,1051 @@ + + + + + + + node-poweredup Class: MoveHubMediumLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MoveHubMediumLinearMotor

+
+ +
+ +

+ MoveHubMediumLinearMotor +

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

new MoveHubMediumLinearMotor()

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

Extends

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

Methods

+ +
+ +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

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

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

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

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

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

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

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

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

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

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

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

Resolved upon successful issuance of the command.

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

Events

+ +
+ +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/MoveHubTiltSensor.html b/docs/MoveHubTiltSensor.html new file mode 100644 index 0000000..c73b163 --- /dev/null +++ b/docs/MoveHubTiltSensor.html @@ -0,0 +1,1288 @@ + + + + + + + node-poweredup Class: MoveHubTiltSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: MoveHubTiltSensor

+
+ +
+ +

+ MoveHubTiltSensor +

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

new MoveHubTiltSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/PUPHub.html b/docs/PUPHub.html index fa01e54..88d3fbd 100644 --- a/docs/PUPHub.html +++ b/docs/PUPHub.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -290,7 +283,7 @@
@@ -326,141 +319,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

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

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -556,7 +416,7 @@
@@ -592,8 +452,8 @@
@@ -653,7 +513,7 @@ - firmwareVersion + hardwareVersion @@ -689,7 +549,7 @@
@@ -725,8 +585,8 @@
@@ -822,7 +682,7 @@
@@ -858,8 +718,141 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> ports

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

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -955,7 +948,7 @@
@@ -991,8 +984,8 @@
@@ -1088,7 +1081,7 @@
@@ -1124,8 +1117,141 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

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

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1221,7 +1347,7 @@
@@ -1257,141 +1383,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

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

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1416,168 +1409,6 @@
-
-
-

brakeMotor(port)

- - -
-
- - -
-

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

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

Resolved upon successful completion of command.

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

connect()

@@ -1648,8 +1479,8 @@
@@ -1700,6 +1531,207 @@ +
+ + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1744,11 +1776,6 @@ - -
Overrides:
-
@@ -1774,8 +1801,8 @@
@@ -1832,7 +1859,7 @@
-

getHubType()

+

getDeviceAtPort(portName)

@@ -1840,129 +1867,7 @@
-

Get the hub type.

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

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1997,7 +1902,7 @@ - port + portName @@ -2014,7 +1919,7 @@ - +

The name of the port to retrieve the device from.

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

rampMotorSpeed(port, fromSpeed, toSpeed, time)

- - -
-
- - -
-

Ramp the motor speed on a given port.

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

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

toSpeed - - -number - - - - -

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

time - - -number - - - - -

How long the ramp should last (in milliseconds).

- - - - -
- - - - - - - - @@ -2302,8 +1972,8 @@
@@ -2332,7 +2002,7 @@
-

Resolved upon successful completion of command.

+

The device attached to the port.

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

resetAbsolutePosition(port)

- - -
-
- - -
-

Reset the current motor position as absolute position zero

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

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

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

setAbsolutePosition(port, pos [, speed])

- - -
-
- - -
-

Tell motor to goto an absolute position

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

The position of the motor to go to

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

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

+
+ + +
+
+

getDevices()

+ + +
+
+ + +
+

Retrieves all attached devices.

+
+ + + + + + + @@ -2695,6 +2061,15 @@ +
Inherited From:
+
+ +
+ @@ -2721,8 +2096,8 @@
@@ -2751,7 +2126,7 @@
-

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

+

Array of all attached devices.

@@ -2762,7 +2137,7 @@
-Promise +Array.<Device> @@ -2779,7 +2154,7 @@
-

setLEDColor(color)

+

getDevicesByType(deviceType)

@@ -2787,7 +2162,7 @@
-

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

+

Retrieves an array of devices of the specified type.

@@ -2822,13 +2197,13 @@ - color + deviceType -Color +number @@ -2839,7 +2214,7 @@ - +

The device type to lookup.

@@ -2861,7 +2236,7 @@
@@ -2892,8 +2267,8 @@
@@ -2922,7 +2297,7 @@
-

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

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

setLEDRGB(red, green, blue)

- - -
-
- - -
-

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

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

Resolved upon successful issuance of command.

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

setLightBrightness(port, brightness [, time])

- - -
-
- - -
-

Set the light brightness on a given port.

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

Brightness value between 0-100 (0 is off)

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

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

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

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

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

setMotorAngle(port, angle [, speed])

- - -
-
- - -
-

Rotate a motor by a given angle.

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

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

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

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

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

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

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

setMotorSpeed(port, speed [, time])

- - -
-
- - -
-

Set the motor speed on a given port.

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

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

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

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

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

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

-
- - - -
-
- Type -
-
- -Promise +Array.<Device> @@ -3993,6 +2413,11 @@
+ +
Overrides:
+
@@ -4018,8 +2443,8 @@
@@ -4114,6 +2539,11 @@
+ +
Overrides:
+
@@ -4139,8 +2569,8 @@
@@ -4206,7 +2636,7 @@

Sleep a given amount of time.

-

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

+

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

@@ -4286,11 +2716,6 @@ - -
Overrides:
-
@@ -4316,8 +2741,8 @@
@@ -4368,402 +2793,6 @@ - - - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

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

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

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

Resolved upon successful issuance of command.

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

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

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

Resolved upon successful issuance of command.

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

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

-

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

+

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

@@ -4859,11 +2888,6 @@ - -
Overrides:
-
@@ -4889,8 +2913,8 @@
@@ -4943,19 +2967,11 @@ - - - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -4963,7 +2979,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

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

+

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

@@ -4998,7 +3015,7 @@ - port + portName @@ -5015,79 +3032,7 @@ - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z - - - - - -number - - - - - - - - - - - +

The name of the port to retrieve the device from.

@@ -5109,7 +3054,7 @@
@@ -5140,8 +3085,8 @@
@@ -5166,6 +3111,30 @@ +
Returns:
+ + +
+

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

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

attach

+

waitForDeviceByType(deviceType)

@@ -5182,7 +3151,8 @@
-

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

+

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

+

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

@@ -5217,13 +3187,13 @@ - port + deviceType -string +number @@ -5234,20 +3204,175 @@ - +

The device type to lookup.

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

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

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

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + - + + @@ -1874,17 +1941,12 @@
- -
Overrides:
-
@@ -1910,8 +1972,8 @@
@@ -1939,6 +2001,10 @@
Returns:
+
+

The device attached to the port.

+
+
@@ -1947,7 +2013,10 @@
-DeviceType +Device +| + +undefined @@ -1964,7 +2033,7 @@
-

setLEDColor(color)

+

getDevices()

@@ -1972,7 +2041,128 @@
-

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

+

Retrieves all attached devices.

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

Array of all attached devices.

+
+ + + +
+
+ Type +
+
+ +Array.<Device> + + + +
+
+ + + + + + + + + +
+
+

getDevicesByType(deviceType)

+ + +
+
+ + +
+

Retrieves an array of devices of the specified type.

@@ -2007,13 +2197,13 @@
- + + @@ -2046,7 +2236,7 @@
@@ -2077,8 +2267,8 @@
@@ -2107,7 +2297,7 @@
-

Resolved upon successful issuance of command.

+

Array of all devices of the specified type.

@@ -2118,226 +2308,7 @@
-Promise - - - -
- - - - - - - - - - -
-
-

setLEDRGB(red, green, blue)

- - -
-
- - -
-

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

-
- - - - - - - - -
Parameters:
- - -
NameTypeDescription
typedevice -DeviceType +Device @@ -5286,11 +3411,6 @@ - -
Overrides:
-
@@ -5316,8 +3436,8 @@
@@ -5423,7 +3543,7 @@
-ButtonState +ButtonState @@ -5463,176 +3583,10 @@ - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - +
Overrides:
+
@@ -5658,203 +3612,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

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

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

Distance, in millimeters.

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

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

+

Emits when a device is detached from the Hub.

@@ -5930,13 +3689,13 @@
portdevice -string +Device @@ -5975,11 +3734,6 @@ - -
Overrides:
-
@@ -6005,8 +3759,8 @@
@@ -6077,11 +3831,6 @@ - -
Overrides:
-
@@ -6107,1130 +3856,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

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

Distance, in millimeters.

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

gyro

- - -
-
- - -
-

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

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

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

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

speed

- - -
-
- - -
-

Emits on a speed change.

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

temp

- - -
-
- - -
-

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

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

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

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

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

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

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

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

(Only available when using a Control+ Hub)

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -7309,7 +3936,7 @@ Documentation generated by JSDoc 3.6.3 - on Tue Dec 3rd 2019 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/PUPRemote.html b/docs/PUPRemote.html index 06ab35c..10d29b7 100644 --- a/docs/PUPRemote.html +++ b/docs/PUPRemote.html @@ -33,21 +33,14 @@ - - @@ -152,8 +145,8 @@
@@ -290,7 +283,7 @@
@@ -326,141 +319,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> current

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

Current usage of the hub (Milliamps)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -556,7 +416,7 @@
@@ -592,8 +452,8 @@
@@ -653,7 +513,7 @@
firmwareVersionhardwareVersion @@ -689,7 +549,7 @@
@@ -725,8 +585,8 @@
@@ -822,7 +682,7 @@
@@ -858,8 +718,141 @@
+
+ + + + + + + + + + + + + + + +
+
+

<readonly> ports

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

Array of port names

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -955,7 +948,7 @@
@@ -991,8 +984,8 @@
@@ -1088,7 +1081,7 @@
@@ -1124,8 +1117,141 @@
+
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

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

Hub type

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -1221,7 +1347,7 @@
@@ -1257,141 +1383,8 @@
-
- - - - - - - -
- - - -
- - - -
-
-

<readonly> voltage

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

Voltage of the hub (Volts)

-
- - - - - - - - -
Inherited From:
-
- -
- - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1486,8 +1479,8 @@
@@ -1538,6 +1531,207 @@ +
+ + + +
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + +
@@ -1582,11 +1776,6 @@ - -
Overrides:
-
@@ -1612,8 +1801,8 @@
@@ -1670,7 +1859,7 @@
-

getHubType()

+

getDeviceAtPort(portName)

@@ -1678,129 +1867,7 @@
-

Get the hub type.

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

getPortDeviceType(port)

- - -
-
- - -
-

Get the device type for a given port.

+

Retrieves the device attached to a given port.

@@ -1835,7 +1902,7 @@
portportName @@ -1852,7 +1919,7 @@ -

The name of the port to retrieve the device from.

colordeviceType -Color +number @@ -2024,7 +2214,7 @@ -

The device type to lookup.

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

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise +Array.<Device> @@ -2442,6 +2413,11 @@
+ +
Overrides:
+
@@ -2467,8 +2443,8 @@
@@ -2563,6 +2539,11 @@
+ +
Overrides:
+
@@ -2588,8 +2569,8 @@
@@ -2655,7 +2636,7 @@

Sleep a given amount of time.

-

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

+

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

@@ -2735,11 +2716,6 @@ - -
Overrides:
-
@@ -2765,8 +2741,8 @@
@@ -2817,402 +2793,6 @@ - - - - -
-
-

subscribe(port [, mode])

- - -
-
- - -
-

Subscribe to sensor notifications on a given port.

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

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

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

Resolved upon successful issuance of command.

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

unsubscribe(port)

- - -
-
- - -
-

Unsubscribe to sensor notifications on a given port.

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

Resolved upon successful issuance of command.

-
- - - -
-
- Type -
-
- -Promise - - - -
-
- - - - -
@@ -3228,7 +2808,7 @@

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

-

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

+

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

@@ -3308,11 +2888,6 @@ - -
Overrides:
-
@@ -3338,8 +2913,8 @@
@@ -3392,19 +2967,11 @@ -
- - - - - -

Events

- -
+
-

accel

+

waitForDeviceAtPort(portName)

@@ -3412,7 +2979,8 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

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

+

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

@@ -3447,7 +3015,7 @@ - port + portName @@ -3464,79 +3032,7 @@ - - - - - - - - x - - - - - -number - - - - - - - - - - - - - - - - - - y - - - - - -number - - - - - - - - - - - - - - - - - - z - - - - - -number - - - - - - - - - - - +

The name of the port to retrieve the device from.

@@ -3558,7 +3054,7 @@
@@ -3589,8 +3085,8 @@
@@ -3615,6 +3111,30 @@ +
Returns:
+ + +
+

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

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + @@ -3623,7 +3143,7 @@
-

attach

+

waitForDeviceByType(deviceType)

@@ -3631,7 +3151,8 @@
-

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

+

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

+

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

@@ -3666,13 +3187,13 @@ - port + deviceType -string +number @@ -3683,20 +3204,175 @@ - +

The device type to lookup.

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

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

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

Events

+ +
+ +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -4998,7 +5963,7 @@ @@ -5046,6 +6011,12 @@ +
Type: +object + + +
+ @@ -5136,7 +6107,7 @@ @@ -5169,7 +6140,7 @@
-

from 0 to 100.

+

reflect

@@ -5184,6 +6155,12 @@ +
Type: +object + + +
+ @@ -5229,7 +6206,7 @@ - + @@ -5274,7 +6251,7 @@ @@ -5307,7 +6284,7 @@
-

from 40 to 2500mm

+

distance

@@ -5322,6 +6299,12 @@ +
Type: +object + + +
+ @@ -5367,7 +6350,7 @@ - + @@ -5412,7 +6395,7 @@ @@ -5445,7 +6428,7 @@
-

from 50 to 320mm

+

fastDistance

@@ -5460,6 +6443,12 @@ +
Type: +object + + +
+ @@ -5505,7 +6494,7 @@ - + @@ -5550,7 +6539,7 @@ @@ -5583,145 +6572,7 @@
-

touch Touched on/off (boolean).

- - -
-
- - -
-

Emits when the sensor is touched.

-
- - - - - - - - -
Parameters:
- - -
NameTypeDescription
typedevice -DeviceType +Device @@ -3735,11 +3411,6 @@ - -
Overrides:
-
@@ -3765,8 +3436,8 @@
@@ -3872,7 +3543,7 @@
-ButtonState +ButtonState @@ -3912,176 +3583,10 @@ - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

color

- - -
-
- - -
-

Emits when a color sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
color - - -Color - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - +
Overrides:
+
@@ -4107,203 +3612,8 @@
-
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

colorAndDistance

- - -
-
- - -
-

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

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

Distance, in millimeters.

- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -4344,7 +3654,7 @@
-

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

+

Emits when a device is detached from the Hub.

@@ -4379,13 +3689,13 @@
portdevice -string +Device @@ -4424,11 +3734,6 @@ - -
Overrides:
-
@@ -4454,8 +3759,8 @@
@@ -4526,11 +3831,6 @@ - -
Overrides:
-
@@ -4556,1130 +3856,8 @@
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

distance

- - -
-
- - -
-

Emits when a distance sensor is activated.

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

Distance, in millimeters.

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

gyro

- - -
-
- - -
-

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

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

rotate

- - -
-
- - -
-

Emits when a rotation sensor is activated.

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

speed

- - -
-
- - -
-

Emits on a speed change.

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

temp

- - -
-
- - -
-

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

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

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

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

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

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

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

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

(Only available when using a Control+ Hub)

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

Class: PiezoBuzzer

+
+ +
+ +

+ PiezoBuzzer +

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

new PiezoBuzzer()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

playTone(frequency, time)

+ + +
+
+ + +
+

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

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
frequency + + +number + + + + +
time + + +number + + + + +

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

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

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

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/RemoteControl.html b/docs/RemoteControl.html index 21f65a4..1872331 100644 --- a/docs/RemoteControl.html +++ b/docs/RemoteControl.html @@ -33,14 +33,14 @@ @@ -513,7 +513,7 @@
firmwareVersionhardwareVersion @@ -1409,6 +1409,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

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

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

First port name

secondPortName + + +string + + + + +

Second port name

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

Resolved upon successful issuance of command.

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

setName(name)

@@ -1709,225 +1905,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

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

button

@@ -2068,178 +2045,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2318,7 +2124,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/RemoteControlButton.html b/docs/RemoteControlButton.html new file mode 100644 index 0000000..0e540b1 --- /dev/null +++ b/docs/RemoteControlButton.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: RemoteControlButton + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: RemoteControlButton

+
+ +
+ +

+ RemoteControlButton +

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

new RemoteControlButton()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

button

+ + +
+
+ + +
+

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

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/SimpleMediumLinearMotor.html b/docs/SimpleMediumLinearMotor.html new file mode 100644 index 0000000..ddd2005 --- /dev/null +++ b/docs/SimpleMediumLinearMotor.html @@ -0,0 +1,1116 @@ + + + + + + + node-poweredup Class: SimpleMediumLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: SimpleMediumLinearMotor

+
+ +
+ +

+ SimpleMediumLinearMotor +

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

new SimpleMediumLinearMotor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TachoMotor.html b/docs/TachoMotor.html new file mode 100644 index 0000000..c4301ef --- /dev/null +++ b/docs/TachoMotor.html @@ -0,0 +1,2419 @@ + + + + + + + node-poweredup Class: TachoMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TachoMotor

+
+ +
+ +

+ TachoMotor +

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

new TachoMotor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

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

Resolved upon successful issuance of the command.

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

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

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

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

toPower + + +number + + + + +

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

time + + +number + + + + +

How long the ramp should last (in milliseconds).

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

Resolved upon successful completion of command.

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

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

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

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

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

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

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

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

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

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

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

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

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

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

Resolved upon successful issuance of the command.

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

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

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

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

Resolved upon successful issuance of the command.

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

stop()

+ + +
+
+ + +
+

Stop the motor.

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

Resolved upon successful issuance of the command.

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

Events

+ +
+ +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicColorSensor.html b/docs/TechnicColorSensor.html new file mode 100644 index 0000000..fff63e9 --- /dev/null +++ b/docs/TechnicColorSensor.html @@ -0,0 +1,1552 @@ + + + + + + + node-poweredup Class: TechnicColorSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicColorSensor

+
+ +
+ +

+ TechnicColorSensor +

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

new TechnicColorSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

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

<readonly> type

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

The type of the device

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

Events

+ +
+ +
+
+

ambient

+ + +
+
+ + +
+

Emits when the ambient light changes.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ambient + + +number + + + + +

Percentage, from 0 to 100.

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

color

+ + +
+
+ + +
+

Emits when a color sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
color + + +Color + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

reflect

+ + +
+
+ + +
+

Emits when the light reflectivity changes.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
reflect + + +number + + + + +

Percentage, from 0 to 100.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicDistanceSensor.html b/docs/TechnicDistanceSensor.html new file mode 100644 index 0000000..611d3ca --- /dev/null +++ b/docs/TechnicDistanceSensor.html @@ -0,0 +1,1646 @@ + + + + + + + node-poweredup Class: TechnicDistanceSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicDistanceSensor

+
+ +
+ +

+ TechnicDistanceSensor +

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

new TechnicDistanceSensor()

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

Extends

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

Members

+ +
+ +
+
+

<readonly> connected

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

Check if the device is still attached.

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

<readonly> hub

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

The Hub the device is attached to.

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

<readonly> isVirtualPort

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

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

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

<readonly> mode

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

The mode the device is currently in

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

<readonly> portName

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

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

setBrightness(topLeft, bottomLeft, topRight, bottomRight)

+ + +
+
+ + +
+

Set the brightness (or turn on/off) the lights around the eyes.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
topLeft + + +number + + + + +

Top left quadrant (above left eye). 0-100 brightness.

bottomLeft + + +number + + + + +

Bottom left quadrant (below left eye). 0-100 brightness.

topRight + + +number + + + + +

Top right quadrant (above right eye). 0-100 brightness.

bottomRight + + +number + + + + +

Bottom right quadrant (below right eye). 0-100 brightness.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

distance

+ + +
+
+ + +
+

Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm).

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
distance + + +number + + + + +

Distance, from 40 to 2500mm

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

fastDistance

+ + +
+
+ + +
+

Emits when the detected distance changes (Fast sampling covers 50mm to 320mm).

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fastDistance + + +number + + + + +

Distance, from 50 to 320mm

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicForceSensor.html b/docs/TechnicForceSensor.html new file mode 100644 index 0000000..18b6c57 --- /dev/null +++ b/docs/TechnicForceSensor.html @@ -0,0 +1,1552 @@ + + + + + + + node-poweredup Class: TechnicForceSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicForceSensor

+
+ +
+ +

+ TechnicForceSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicForceSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

force

+ + +
+
+ + +
+

Emits when force is applied.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
force + + +number + + + + +

Force, in newtons (0-10).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tapped

+ + +
+
+ + +
+

Emits when the sensor is tapped.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tapped + + +number + + + + +

How hard the sensor was tapped, from 0-3.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

touch

+ + +
+
+ + +
+

Emits when the sensor is touched.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
touch + + +boolean + + + + +

Touched on/off (boolean).

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicLargeAngularMotor.html b/docs/TechnicLargeAngularMotor.html new file mode 100644 index 0000000..8e6d4e8 --- /dev/null +++ b/docs/TechnicLargeAngularMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicLargeAngularMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicLargeAngularMotor

+
+ +
+ +

+ TechnicLargeAngularMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicLargeAngularMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicLargeLinearMotor.html b/docs/TechnicLargeLinearMotor.html new file mode 100644 index 0000000..da90676 --- /dev/null +++ b/docs/TechnicLargeLinearMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicLargeLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicLargeLinearMotor

+
+ +
+ +

+ TechnicLargeLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicLargeLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumAngularMotor.html b/docs/TechnicMediumAngularMotor.html new file mode 100644 index 0000000..103dd32 --- /dev/null +++ b/docs/TechnicMediumAngularMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicMediumAngularMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumAngularMotor

+
+ +
+ +

+ TechnicMediumAngularMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumAngularMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHub.html b/docs/TechnicMediumHub.html index 9c221df..777a1cb 100644 --- a/docs/TechnicMediumHub.html +++ b/docs/TechnicMediumHub.html @@ -33,14 +33,14 @@ @@ -513,7 +513,7 @@
firmwareVersionhardwareVersion @@ -1409,6 +1409,202 @@
+
+
+

createVirtualPort(firstPortName, secondPortName)

+ + +
+
+ + +
+

Combines two ports with into a single virtual port.

+

Note: The devices attached to the ports must be of the same device type.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstPortName + + +string + + + + +

First port name

secondPortName + + +string + + + + +

Second port name

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + +

setName(name)

@@ -1709,225 +1905,6 @@
-
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - -

button

@@ -2068,178 +2045,7 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2318,7 +2124,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/TechnicMediumHubAccelerometerSensor.html b/docs/TechnicMediumHubAccelerometerSensor.html new file mode 100644 index 0000000..8fcb059 --- /dev/null +++ b/docs/TechnicMediumHubAccelerometerSensor.html @@ -0,0 +1,1312 @@ + + + + + + + node-poweredup Class: TechnicMediumHubAccelerometerSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHubAccelerometerSensor

+
+ +
+ +

+ TechnicMediumHubAccelerometerSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHubAccelerometerSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

accel

+ + +
+
+ + +
+

Emits when accelerometer detects movement. Measured in mG.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHubGyroSensor.html b/docs/TechnicMediumHubGyroSensor.html new file mode 100644 index 0000000..dce0108 --- /dev/null +++ b/docs/TechnicMediumHubGyroSensor.html @@ -0,0 +1,1312 @@ + + + + + + + node-poweredup Class: TechnicMediumHubGyroSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHubGyroSensor

+
+ +
+ +

+ TechnicMediumHubGyroSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHubGyroSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

gyro

+ + +
+
+ + +
+

Emits when gyroscope detects movement. Measured in DPS - degrees per second.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicMediumHubTiltSensor.html b/docs/TechnicMediumHubTiltSensor.html new file mode 100644 index 0000000..507708f --- /dev/null +++ b/docs/TechnicMediumHubTiltSensor.html @@ -0,0 +1,1312 @@ + + + + + + + node-poweredup Class: TechnicMediumHubTiltSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicMediumHubTiltSensor

+
+ +
+ +

+ TechnicMediumHubTiltSensor +

+ + +
+ + +
+
+ + +
+
+

new TechnicMediumHubTiltSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
z + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TechnicXLargeLinearMotor.html b/docs/TechnicXLargeLinearMotor.html new file mode 100644 index 0000000..55636fb --- /dev/null +++ b/docs/TechnicXLargeLinearMotor.html @@ -0,0 +1,1431 @@ + + + + + + + node-poweredup Class: TechnicXLargeLinearMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TechnicXLargeLinearMotor

+
+ +
+ +

+ TechnicXLargeLinearMotor +

+ + +
+ + +
+
+ + +
+
+

new TechnicXLargeLinearMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

gotoAngle(angle [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given angle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
angle + + +number + + + + + + + + + + + + +

Absolute position the motor should go to (degrees from 0).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rotateByDegrees(degrees [, speed])

+ + +
+
+ + +
+

Rotate a motor by a given amount of degrees.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
degrees + + +number + + + + + + + + + + + + +

How much the motor should be rotated (in degrees).

speed + + +number + + + + + + + <optional>
+ + + + + +
+ + 100 + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command (ie. once the motor is finished).

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setBrakingStyle(style)

+ + +
+
+ + +
+

Set the braking style of the motor.

+

Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
style + + +number + + + + +

Either BRAKE or HOLD

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

setSpeed(speed)

+ + +
+
+ + +
+

Set the motor speed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
speed + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +

Events

+ +
+ +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TiltSensor.html b/docs/TiltSensor.html new file mode 100644 index 0000000..f079ef9 --- /dev/null +++ b/docs/TiltSensor.html @@ -0,0 +1,1288 @@ + + + + + + + node-poweredup Class: TiltSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TiltSensor

+
+ +
+ +

+ TiltSensor +

+ + +
+ + +
+
+ + +
+
+

new TiltSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/TrainMotor.html b/docs/TrainMotor.html new file mode 100644 index 0000000..a3c62cc --- /dev/null +++ b/docs/TrainMotor.html @@ -0,0 +1,1752 @@ + + + + + + + node-poweredup Class: TrainMotor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: TrainMotor

+
+ +
+ +

+ TrainMotor +

+ + +
+ + +
+
+ + +
+
+

new TrainMotor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

brake()

+ + +
+
+ + +
+

Brake the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

rampPower(fromPower, toPower, time)

+ + +
+
+ + +
+

Ramp the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

toPower + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

time + + +number + + + + +

How long the ramp should last (in milliseconds).

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful completion of command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

setPower(power)

+ + +
+
+ + +
+

Set the motor power.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
power + + +number + + + + +

For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.

+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

stop()

+ + +
+
+ + +
+

Stop the motor.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Resolved upon successful issuance of the command.

+
+ + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/VoltageSensor.html b/docs/VoltageSensor.html new file mode 100644 index 0000000..33779a0 --- /dev/null +++ b/docs/VoltageSensor.html @@ -0,0 +1,1264 @@ + + + + + + + node-poweredup Class: VoltageSensor + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: VoltageSensor

+
+ +
+ +

+ VoltageSensor +

+ + +
+ + +
+
+ + +
+
+

new VoltageSensor()

+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ +
+ +
+
+

<readonly> connected

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
connected + + +boolean + + + + +

Check if the device is still attached.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> hub

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hub + + +Hub + + + + +

The Hub the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> isVirtualPort

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
isVirtualPort + + +boolean + + + + +

Is this device attached to a virtual port (ie. a combined device)

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> mode

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
mode + + +number + + + + +

The mode the device is currently in

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> portName

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portName + + +string + + + + +

The port the device is attached to.

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

<readonly> type

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +number + + + + +

The type of the device

+
+ + + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + + + + + +

Events

+ +
+ +
+
+

voltage

+ + +
+
+ + +
+

Emits when a voltage change is detected.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
voltage + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + +
+ + + + node-poweredup by Nathan Kellenicki licensed under the MIT license. + + + + Documentation generated by JSDoc 3.6.3 + + on Mon Feb 10th 2020 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/WeDo2SmartHub.html b/docs/WeDo2SmartHub.html index 5479d68..b4f195f 100644 --- a/docs/WeDo2SmartHub.html +++ b/docs/WeDo2SmartHub.html @@ -33,14 +33,14 @@ @@ -501,7 +501,7 @@
firmwareVersionhardwareVersion @@ -1854,7 +1854,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index 5d56af0..d5c59b7 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -33,14 +33,14 @@ @@ -142,27 +142,135 @@

Classes

+
AbsoluteMotor
+
+
BaseHub
+
BasicMotor
+
+ +
BoostMoveHub
+
+ +
ColorDistanceSensor
+
+ +
ControlPlusHub
+
+ +
CurrentSensor
+
+ +
Device
+
+
DuploTrainBase
+
DuploTrainBaseColorSensor
+
+ +
DuploTrainBaseMotor
+
+ +
DuploTrainBaseSpeaker
+
+ +
DuploTraniBaseSpeedometer
+
+
Hub
+
HubLED
+
+ +
Light
+
+
LPF2Hub
+
MediumLinearMotor
+
+ +
MotionSensor
+
+
MoveHub
+
MoveHubMediumLinearMotor
+
+ +
MoveHubTiltSensor
+
+ +
PiezoBuzzer
+
+ +
PUPHub
+
+ +
PUPRemote
+
+
RemoteControl
+
RemoteControlButton
+
+ +
SimpleMediumLinearMotor
+
+ +
TachoMotor
+
+ +
TechnicColorSensor
+
+ +
TechnicDistanceSensor
+
+ +
TechnicForceSensor
+
+ +
TechnicLargeAngularMotor
+
+ +
TechnicLargeLinearMotor
+
+ +
TechnicMediumAngularMotor
+
+
TechnicMediumHub
+
TechnicMediumHubAccelerometerSensor
+
+ +
TechnicMediumHubGyroSensor
+
+ +
TechnicMediumHubTiltSensor
+
+ +
TechnicXLargeLinearMotor
+
+ +
TiltSensor
+
+ +
TrainMotor
+
+ +
VoltageSensor
+
+
WeDo2SmartHub
@@ -200,6 +308,12 @@ +
Type: +object + + +
+ @@ -290,7 +404,722 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -338,6 +1167,12 @@ +
Type: +object + + +
+ @@ -428,7 +1263,7 @@
@@ -476,6 +1311,12 @@ +
Type: +object + + +
+ @@ -590,7 +1431,7 @@ @@ -638,6 +1479,12 @@ +
Type: +object + + +
+ @@ -728,7 +1575,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -776,6 +2185,12 @@ +
Type: +object + + +
+ @@ -866,226 +2281,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1256,178 +2452,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -1475,6 +2500,12 @@ +
Type: +object + + +
+ @@ -1565,7 +2596,7 @@
@@ -1613,6 +2644,12 @@ +
Type: +object + + +
+ @@ -1703,226 +2740,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2004,7 +2822,7 @@
-Device +Device @@ -2060,145 +2878,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

attach

- - -
-
- - -
-

Emits when a device is detached from the Hub.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
device - - -Device - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -2369,7 +3049,145 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -2484,387 +3302,6 @@ -
- - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - -
@@ -3000,7 +3437,7 @@ @@ -3033,7 +3470,7 @@
-

tilt

+

rotate

@@ -3041,13 +3478,19 @@
-

Emits when a tilt sensor is activated.

+

Emits when a rotation sensor is activated.

+
Type: +object + + +
+ @@ -3076,31 +3519,7 @@
x - - -number - - - - -
yrotation @@ -3135,6 +3554,15 @@ +
Inherited From:
+
+ +
+ @@ -3161,8 +3589,8 @@
@@ -3210,6 +3638,12 @@ +
Type: +object + + +
+ @@ -3300,226 +3734,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

accel

- - -
-
- - -
-

Emits when accelerometer detects movement. Measured in mG.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -3690,7 +3905,7 @@
@@ -3723,7 +3938,7 @@
-

tilt

+

rotate

@@ -3731,13 +3946,19 @@
-

Emits when a tilt sensor is activated.

+

Emits when a rotation sensor is activated.

+
Type: +object + + +
+ @@ -3766,31 +3987,7 @@
x - - -number - - - - -
yrotation @@ -3829,7 +4026,7 @@
@@ -3860,8 +4057,8 @@
@@ -3909,6 +4106,12 @@ +
Type: +object + + +
+ @@ -4023,7 +4226,7 @@ @@ -4056,7 +4259,7 @@
-

accel

+

attach

@@ -4064,7 +4267,7 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Emits when a device is attached to the Hub.

@@ -4099,85 +4302,13 @@
portdevice -string - - - - -
x - - -number - - - - -
y - - -number - - - - -
z - - -number +Device @@ -4210,7 +4341,7 @@
@@ -4241,8 +4372,995 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

attach

+ + +
+
+ + +
+

Emits when a device is attached to the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

button

+ + +
+
+ + +
+

Emits when a button is pressed.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
button + + +string + + + + +
state + + +ButtonState + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

detach

+ + +
+
+ + +
+

Emits when a device is detached from the Hub.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +Device + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

disconnect

+ + +
+
+ + +
+

Emits when the hub is disconnected.

+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -4413,178 +5531,7 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

tilt

- - -
-
- - -
-

Emits when a tilt sensor is activated.

-
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
- - - - -
- - - - - - - -
Inherited From:
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
-
@@ -4632,6 +5579,12 @@ +
Type: +object + + +
+ @@ -4722,7 +5675,7 @@
@@ -4770,6 +5723,12 @@ +
Type: +object + + +
+ @@ -4860,7 +5819,7 @@ @@ -4893,7 +5852,7 @@
-

from 0 to 100.

+

ambient

@@ -4908,6 +5867,12 @@ +
Type: +object + + +
+ @@ -4953,7 +5918,7 @@ -

Percentage, from 0 to 100.

Percentage, from 0 to 100.

Distance, from 40 to 2500mm

Distance, from 50 to 320mm

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
touch - - -boolean - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- -
- - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

in newtons (0-10).

+

force

@@ -5736,6 +6587,12 @@ +
Type: +object + + +
+ @@ -5781,7 +6638,7 @@ - +

Force, in newtons (0-10).

@@ -5826,7 +6683,7 @@ @@ -5859,7 +6716,7 @@
-

from 0-3.

+

tapped

@@ -5874,6 +6731,12 @@ +
Type: +object + + +
+ @@ -5919,7 +6782,7 @@ - +

How hard the sensor was tapped, from 0-3.

@@ -5964,7 +6827,7 @@ @@ -5997,7 +6860,7 @@
-

accel

+

touch

@@ -6005,13 +6868,19 @@
-

Emits when accelerometer detects movement. Measured in mG.

+

Emits when the sensor is touched.

+
Type: +object + + +
+ @@ -6040,13 +6909,13 @@ - port + touch -string +boolean @@ -6057,62 +6926,134 @@ - +

Touched on/off (boolean).

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -6489,15 +8225,6 @@ -
Inherited From:
-
- -
- @@ -6524,8 +8251,8 @@
@@ -6573,6 +8300,12 @@ +
Type: +object + + +
+ @@ -6711,7 +8444,7 @@ @@ -6759,6 +8492,12 @@ +
Type: +object + + +
+ @@ -6897,7 +8636,481 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + +
NameTypeDescription
x - - -number - - - - -
y - - -number - - - - -
zabsolute @@ -6151,7 +7092,7 @@
@@ -6182,8 +7123,773 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

absolute

+ + +
+
+ + +
+

Emits when a the motors absolute position is changed.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6354,7 +8060,7 @@
@@ -6387,7 +8093,7 @@
-

tilt

+

accel

@@ -6395,13 +8101,19 @@
-

Emits when a tilt sensor is activated.

+

Emits when accelerometer detects movement. Measured in mG.

+
Type: +object + + +
+ @@ -6471,6 +8183,30 @@ +
z + + +number + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
absolute + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

rotate

+ + +
+
+ + +
+

Emits when a rotation sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rotation + + +number + + + + +
+ + + + +
+ + + + + + + +
Inherited From:
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

tilt

+ + +
+
+ + +
+

Emits when a tilt sensor is activated.

+
+ + + + + +
Type: +object + + +
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +
y + + +number + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+
@@ -6945,6 +9158,12 @@ +
Type: +object + + +
+ @@ -7035,7 +9254,7 @@
@@ -7276,7 +9495,7 @@ Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_absolutemotor.js.html b/docs/devices_absolutemotor.js.html index b326086..e877cba 100644 --- a/docs/devices_absolutemotor.js.html +++ b/docs/devices_absolutemotor.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tachomotor_1 = require("./tachomotor"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class AbsoluteMotor + * @extends TachoMotor + */ class AbsoluteMotor extends tachomotor_1.TachoMotor { constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) { super(hub, portId, Object.assign({}, modeMap, exports.ModeMap), type); @@ -101,6 +105,7 @@ class AbsoluteMotor extends tachomotor_1.TachoMotor { /** * Emits when a the motors absolute position is changed. * @event AbsoluteMotor#absolute + * @type {object} * @param {number} absolute */ this.notify("absolute", { angle }); @@ -202,7 +207,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_basicmotor.js.html b/docs/devices_basicmotor.js.html index 5a8203b..a3c3a8e 100644 --- a/docs/devices_basicmotor.js.html +++ b/docs/devices_basicmotor.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class BasicMotor + * @extends Device + */ class BasicMotor extends device_1.Device { constructor(hub, portId, modeMap, type = Consts.DeviceType.UNKNOWN) { super(hub, portId, modeMap, type); @@ -97,7 +101,7 @@ class BasicMotor extends device_1.Device { * Set the motor power. * @method BasicMotor#setPower * @param {number} power For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setPower(power, interrupt = true) { if (interrupt) { @@ -129,7 +133,7 @@ class BasicMotor extends device_1.Device { /** * Stop the motor. * @method BasicMotor#stop - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ stop() { this.cancelEventTimer(); @@ -138,7 +142,7 @@ class BasicMotor extends device_1.Device { /** * Brake the motor. * @method BasicMotor#brake - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ brake() { this.cancelEventTimer(); @@ -191,7 +195,7 @@ exports.BasicMotor = BasicMotor; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_colordistancesensor.js.html b/docs/devices_colordistancesensor.js.html index ecbb848..a78c7ff 100644 --- a/docs/devices_colordistancesensor.js.html +++ b/docs/devices_colordistancesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class ColorDistanceSensor + * @extends Device + */ class ColorDistanceSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.COLOR_DISTANCE_SENSOR); @@ -101,6 +105,7 @@ class ColorDistanceSensor extends device_1.Device { /** * Emits when a color sensor is activated. * @event ColorDistanceSensor#color + * @type {object} * @param {Color} color */ this.notify("color", { color }); @@ -115,6 +120,7 @@ class ColorDistanceSensor extends device_1.Device { /** * Emits when a distance sensor is activated. * @event ColorDistanceSensor#distance + * @type {object} * @param {number} distance Distance, in millimeters. */ this.notify("distance", { distance }); @@ -133,6 +139,7 @@ class ColorDistanceSensor extends device_1.Device { /** * A combined color and distance event, emits when the sensor is activated. * @event ColorDistanceSensor#colorAndDistance + * @type {object} * @param {Color} color * @param {number} distance Distance, in millimeters. */ @@ -201,7 +208,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_currentsensor.js.html b/docs/devices_currentsensor.js.html index 1505e38..bae4660 100644 --- a/docs/devices_currentsensor.js.html +++ b/docs/devices_currentsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class CurrentSensor + * @extends Device + */ class CurrentSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.CURRENT_SENSOR); @@ -113,6 +117,7 @@ class CurrentSensor extends device_1.Device { /** * Emits when a current change is detected. * @event CurrentSensor#current + * @type {object} * @param {number} current */ this.notify("current", { current }); @@ -181,7 +186,7 @@ const MaxCurrentRaw = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_device.js.html b/docs/devices_device.js.html new file mode 100644 index 0000000..cba74fb --- /dev/null +++ b/docs/devices_device.js.html @@ -0,0 +1,379 @@ + + + + + + + node-poweredup Source: devices/device.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/device.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const events_1 = require("events");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class Device
+ * @extends EventEmitter
+ */
+class Device extends events_1.EventEmitter {
+    constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) {
+        super();
+        this.autoSubscribe = true;
+        this.values = {};
+        this._busy = false;
+        this._connected = true;
+        this._modeMap = {};
+        this._isVirtualPort = false;
+        this._eventTimer = null;
+        this._hub = hub;
+        this._portId = portId;
+        this._type = type;
+        this._modeMap = modeMap;
+        this._isWeDo2SmartHub = (this.hub.type === Consts.HubType.WEDO2_SMART_HUB);
+        this._isVirtualPort = this.hub.isPortVirtual(portId);
+        const eventAttachListener = (event) => {
+            if (event === "detach") {
+                return;
+            }
+            if (this.autoSubscribe) {
+                if (this._modeMap[event] !== undefined) {
+                    this.subscribe(this._modeMap[event]);
+                }
+            }
+        };
+        const deviceDetachListener = (device) => {
+            if (device.portId === this.portId) {
+                this._connected = false;
+                this.hub.removeListener("detach", deviceDetachListener);
+                this.emit("detach");
+            }
+        };
+        for (const event in this._modeMap) {
+            if (this.hub.listenerCount(event) > 0) {
+                eventAttachListener(event);
+            }
+        }
+        this.hub.on("newListener", eventAttachListener);
+        this.on("newListener", eventAttachListener);
+        this.hub.on("detach", deviceDetachListener);
+    }
+    /**
+     * @readonly
+     * @property {boolean} connected Check if the device is still attached.
+     */
+    get connected() {
+        return this._connected;
+    }
+    /**
+     * @readonly
+     * @property {Hub} hub The Hub the device is attached to.
+     */
+    get hub() {
+        return this._hub;
+    }
+    get portId() {
+        return this._portId;
+    }
+    /**
+     * @readonly
+     * @property {string} portName The port the device is attached to.
+     */
+    get portName() {
+        return this.hub.getPortNameForPortId(this.portId);
+    }
+    /**
+     * @readonly
+     * @property {number} type The type of the device
+     */
+    get type() {
+        return this._type;
+    }
+    get typeName() {
+        return Consts.DeviceTypeNames[this.type];
+    }
+    /**
+     * @readonly
+     * @property {number} mode The mode the device is currently in
+     */
+    get mode() {
+        return this._mode;
+    }
+    get isWeDo2SmartHub() {
+        return this._isWeDo2SmartHub;
+    }
+    /**
+     * @readonly
+     * @property {boolean} isVirtualPort Is this device attached to a virtual port (ie. a combined device)
+     */
+    get isVirtualPort() {
+        return this._isVirtualPort;
+    }
+    writeDirect(mode, data, callback) {
+        if (this.isWeDo2SmartHub) {
+            this.send(Buffer.concat([Buffer.from([this.portId, 0x01, 0x02]), data]), Consts.BLECharacteristic.WEDO2_MOTOR_VALUE_WRITE);
+        }
+        else {
+            this.send(Buffer.concat([Buffer.from([0x81, this.portId, 0x11, 0x51, mode]), data]), Consts.BLECharacteristic.LPF2_ALL, callback);
+        }
+    }
+    send(data, characteristic = Consts.BLECharacteristic.LPF2_ALL, callback) {
+        this._ensureConnected();
+        this.hub.send(data, characteristic, callback);
+    }
+    subscribe(mode) {
+        this._ensureConnected();
+        if (mode !== this._mode) {
+            this._mode = mode;
+            this.hub.subscribe(this.portId, this.type, mode);
+        }
+    }
+    unsubscribe(mode) {
+        this._ensureConnected();
+    }
+    receive(message) {
+        this.notify("receive", { message });
+    }
+    notify(event, values) {
+        this.values[event] = values;
+        this.emit(event, values);
+        if (this.hub.listenerCount(event) > 0) {
+            this.hub.emit(event, this, values);
+        }
+    }
+    finish() {
+        this._busy = false;
+        if (this._finished) {
+            this._finished();
+            this._finished = undefined;
+        }
+    }
+    setEventTimer(timer) {
+        this._eventTimer = timer;
+    }
+    cancelEventTimer() {
+        if (this._eventTimer) {
+            clearTimeout(this._eventTimer);
+            this._eventTimer = null;
+        }
+    }
+    _ensureConnected() {
+        if (!this.connected) {
+            throw new Error("Device is not connected");
+        }
+    }
+}
+exports.Device = Device;
+//# sourceMappingURL=device.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasecolorsensor.js.html b/docs/devices_duplotrainbasecolorsensor.js.html index 8a4df3a..44591a8 100644 --- a/docs/devices_duplotrainbasecolorsensor.js.html +++ b/docs/devices_duplotrainbasecolorsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class DuploTrainBaseColorSensor + * @extends Device + */ class DuploTrainBaseColorSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.DUPLO_TRAIN_BASE_COLOR_SENSOR); @@ -101,6 +105,7 @@ class DuploTrainBaseColorSensor extends device_1.Device { /** * Emits when a color sensor is activated. * @event DuploTrainBaseColorSensor#color + * @type {object} * @param {Color} color */ this.notify("color", { color }); @@ -162,7 +167,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_duplotrainbasemotor.js.html b/docs/devices_duplotrainbasemotor.js.html new file mode 100644 index 0000000..50d36a5 --- /dev/null +++ b/docs/devices_duplotrainbasemotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/duplotrainbasemotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/duplotrainbasemotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class DuploTrainBaseMotor
+ * @extends BasicMotor
+ */
+class DuploTrainBaseMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.DUPLO_TRAIN_BASE_MOTOR);
+    }
+}
+exports.DuploTrainBaseMotor = DuploTrainBaseMotor;
+//# sourceMappingURL=duplotrainbasemotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_duplotrainbasespeaker.js.html b/docs/devices_duplotrainbasespeaker.js.html index f7985b8..3c631ee 100644 --- a/docs/devices_duplotrainbasespeaker.js.html +++ b/docs/devices_duplotrainbasespeaker.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class DuploTrainBaseSpeaker + * @extends Device + */ class DuploTrainBaseSpeaker extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.DUPLO_TRAIN_BASE_SPEAKER); @@ -96,7 +100,7 @@ class DuploTrainBaseSpeaker extends device_1.Device { * Play a built-in train sound. * @method DuploTrainBaseSpeaker#playSound * @param {DuploTrainBaseSound} sound - * @returns {Promise} Resolved upon successful issuance of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ playSound(sound) { return new Promise((resolve, reject) => { @@ -156,7 +160,7 @@ var Mode; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_duplotrainbasespeedometer.js.html b/docs/devices_duplotrainbasespeedometer.js.html index 6be089b..37908aa 100644 --- a/docs/devices_duplotrainbasespeedometer.js.html +++ b/docs/devices_duplotrainbasespeedometer.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class DuploTraniBaseSpeedometer + * @extends Device + */ class DuploTrainBaseSpeedometer extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.DUPLO_TRAIN_BASE_SPEEDOMETER); @@ -100,6 +104,7 @@ class DuploTrainBaseSpeedometer extends device_1.Device { /** * Emits on a speed change. * @event DuploTrainBaseSpeedometer#speed + * @type {object} * @param {number} speed */ this.notify("speed", { speed }); @@ -160,7 +165,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_hubled.js.html b/docs/devices_hubled.js.html index 3340263..f98b5c5 100644 --- a/docs/devices_hubled.js.html +++ b/docs/devices_hubled.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class HubLED + * @extends Device + */ class HubLED extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.HUB_LED); @@ -96,7 +100,7 @@ class HubLED extends device_1.Device { * Set the color of the LED on the Hub via a color value. * @method HubLED#setColor * @param {Color} color - * @returns {Promise} Resolved upon successful issuance of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setColor(color) { return new Promise((resolve, reject) => { @@ -120,7 +124,7 @@ class HubLED extends device_1.Device { * @param {number} red * @param {number} green * @param {number} blue - * @returns {Promise} Resolved upon successful issuance of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setRGB(red, green, blue) { return new Promise((resolve, reject) => { @@ -187,7 +191,7 @@ var Mode; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_light.js.html b/docs/devices_light.js.html index 87521bc..1968a20 100644 --- a/docs/devices_light.js.html +++ b/docs/devices_light.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class Light + * @extends Device + */ class Light extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.LIGHT); @@ -173,7 +177,7 @@ exports.Light = Light; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_mediumlinearmotor.js.html b/docs/devices_mediumlinearmotor.js.html new file mode 100644 index 0000000..da4432b --- /dev/null +++ b/docs/devices_mediumlinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/mediumlinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/mediumlinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const tachomotor_1 = require("./tachomotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class MediumLinearMotor
+ * @extends TachoMotor
+ */
+class MediumLinearMotor extends tachomotor_1.TachoMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.MEDIUM_LINEAR_MOTOR);
+    }
+}
+exports.MediumLinearMotor = MediumLinearMotor;
+//# sourceMappingURL=mediumlinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_motionsensor.js.html b/docs/devices_motionsensor.js.html index c4f16b1..6b139e6 100644 --- a/docs/devices_motionsensor.js.html +++ b/docs/devices_motionsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class MotionSensor + * @extends Device + */ class MotionSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.MOTION_SENSOR); @@ -104,6 +108,7 @@ class MotionSensor extends device_1.Device { /** * Emits when a distance sensor is activated. * @event MotionSensor#distance + * @type {object} * @param {number} distance Distance, in millimeters. */ this.notify("distance", { distance }); @@ -164,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_movehubmediumlinearmotor.js.html b/docs/devices_movehubmediumlinearmotor.js.html new file mode 100644 index 0000000..98a5565 --- /dev/null +++ b/docs/devices_movehubmediumlinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/movehubmediumlinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/movehubmediumlinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const tachomotor_1 = require("./tachomotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class MoveHubMediumLinearMotor
+ * @extends TachoMotor
+ */
+class MoveHubMediumLinearMotor extends tachomotor_1.TachoMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR);
+    }
+}
+exports.MoveHubMediumLinearMotor = MoveHubMediumLinearMotor;
+//# sourceMappingURL=movehubmediumlinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_movehubtiltsensor.js.html b/docs/devices_movehubtiltsensor.js.html index c3bdc7c..0ee58b7 100644 --- a/docs/devices_movehubtiltsensor.js.html +++ b/docs/devices_movehubtiltsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class MoveHubTiltSensor + * @extends Device + */ class MoveHubTiltSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.MOVE_HUB_TILT_SENSOR); @@ -99,6 +103,7 @@ class MoveHubTiltSensor extends device_1.Device { /** * Emits when a tilt sensor is activated. * @event MoveHubTiltSensor#tilt + * @type {object} * @param {number} x * @param {number} y */ @@ -162,7 +167,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_piezobuzzer.js.html b/docs/devices_piezobuzzer.js.html index 9edb6bd..846d4d5 100644 --- a/docs/devices_piezobuzzer.js.html +++ b/docs/devices_piezobuzzer.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class PiezoBuzzer + * @extends Device + */ class PiezoBuzzer extends device_1.Device { constructor(hub, portId) { super(hub, portId, {}, Consts.DeviceType.PIEZO_BUZZER); @@ -155,7 +159,7 @@ exports.PiezoBuzzer = PiezoBuzzer; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_remotecontrolbutton.js.html b/docs/devices_remotecontrolbutton.js.html index db27234..eabf292 100644 --- a/docs/devices_remotecontrolbutton.js.html +++ b/docs/devices_remotecontrolbutton.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class RemoteControlButton + * @extends Device + */ class RemoteControlButton extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.REMOTE_CONTROL_BUTTON); @@ -99,6 +103,7 @@ class RemoteControlButton extends device_1.Device { /** * Emits when a button on the remote is pressed or released. * @event RemoteControlButton#button + * @type {object} * @param {number} event */ const event = message[4]; @@ -166,7 +171,7 @@ exports.ButtonState = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_simplemediumlinearmotor.js.html b/docs/devices_simplemediumlinearmotor.js.html new file mode 100644 index 0000000..1dc20e4 --- /dev/null +++ b/docs/devices_simplemediumlinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/simplemediumlinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/simplemediumlinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class SimpleMediumLinearMotor
+ * @extends Device
+ */
+class SimpleMediumLinearMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.SIMPLE_MEDIUM_LINEAR_MOTOR);
+    }
+}
+exports.SimpleMediumLinearMotor = SimpleMediumLinearMotor;
+//# sourceMappingURL=simplemediumlinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_tachomotor.js.html b/docs/devices_tachomotor.js.html index 1e2ce11..e19b347 100644 --- a/docs/devices_tachomotor.js.html +++ b/docs/devices_tachomotor.js.html @@ -33,14 +33,14 @@ @@ -89,6 +89,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const basicmotor_1 = require("./basicmotor"); const Consts = __importStar(require("../consts")); const utils_1 = require("../utils"); +/** + * @class TachoMotor + * @extends BasicMotor + */ class TachoMotor extends basicmotor_1.BasicMotor { constructor(hub, portId, modeMap = {}, type = Consts.DeviceType.UNKNOWN) { super(hub, portId, Object.assign({}, modeMap, exports.ModeMap), type); @@ -102,12 +106,20 @@ class TachoMotor extends basicmotor_1.BasicMotor { /** * Emits when a rotation sensor is activated. * @event TachoMotor#rotate + * @type {object} * @param {number} rotation */ this.notify("rotate", { degrees }); break; } } + /** + * Set the braking style of the motor. + * + * Note: This applies to setSpeed, rotateByDegrees, and gotoAngle. + * @method TachoMotor#setBrakingStyle + * @param {number} style Either BRAKE or HOLD + */ setBrakingStyle(style) { this._brakeStyle = style; } @@ -115,7 +127,7 @@ class TachoMotor extends basicmotor_1.BasicMotor { * Set the motor speed. * @method TachoMotor#setSpeed * @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setSpeed(speed, time) { if (!this.isVirtualPort && speed instanceof Array) { @@ -242,7 +254,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_techniccolorsensor.js.html b/docs/devices_techniccolorsensor.js.html index 104ed63..603acc6 100644 --- a/docs/devices_techniccolorsensor.js.html +++ b/docs/devices_techniccolorsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicColorSensor + * @extends Device + */ class TechnicColorSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_COLOR_SENSOR); @@ -101,6 +105,7 @@ class TechnicColorSensor extends device_1.Device { /** * Emits when a color sensor is activated. * @event TechnicColorSensor#color + * @type {object} * @param {Color} color */ this.notify("color", { color }); @@ -110,8 +115,9 @@ class TechnicColorSensor extends device_1.Device { const reflect = message[4]; /** * Emits when the light reflectivity changes. - * @event TechnicColorSensor#reflect Percentage, from 0 to 100. - * @param {number} reflect + * @event TechnicColorSensor#reflect + * @type {object} + * @param {number} reflect Percentage, from 0 to 100. */ this.notify("reflect", { reflect }); break; @@ -119,8 +125,9 @@ class TechnicColorSensor extends device_1.Device { const ambient = message[4]; /** * Emits when the ambient light changes. - * @event TechnicColorSensor#ambient Percentage, from 0 to 100. - * @param {number} ambient + * @event TechnicColorSensor#ambient + * @type {object} + * @param {number} ambient Percentage, from 0 to 100. */ this.notify("ambient", { ambient }); break; @@ -184,7 +191,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicdistancesensor.js.html b/docs/devices_technicdistancesensor.js.html index ede059c..525d89a 100644 --- a/docs/devices_technicdistancesensor.js.html +++ b/docs/devices_technicdistancesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicDistanceSensor + * @extends Device + */ class TechnicDistanceSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_DISTANCE_SENSOR); @@ -99,8 +103,9 @@ class TechnicDistanceSensor extends device_1.Device { const distance = message.readUInt16LE(4); /** * Emits when the detected distance changes (Slow sampling covers 40mm to 2500mm). - * @event TechnicDistanceSensor#distance Distance, from 40 to 2500mm - * @param {number} distance + * @event TechnicDistanceSensor#distance + * @type {object} + * @param {number} distance Distance, from 40 to 2500mm */ this.notify("distance", { distance }); break; @@ -108,8 +113,9 @@ class TechnicDistanceSensor extends device_1.Device { const fastDistance = message.readUInt16LE(4); /** * Emits when the detected distance changes (Fast sampling covers 50mm to 320mm). - * @event TechnicDistanceSensor#fastDistance Distance, from 50 to 320mm - * @param {number} fastDistance + * @event TechnicDistanceSensor#fastDistance + * @type {object} + * @param {number} fastDistance Distance, from 50 to 320mm */ this.notify("fastDistance", { fastDistance }); break; @@ -122,7 +128,7 @@ class TechnicDistanceSensor extends device_1.Device { * @param {number} bottomLeft Bottom left quadrant (below left eye). 0-100 brightness. * @param {number} topRight Top right quadrant (above right eye). 0-100 brightness. * @param {number} bottomRight Bottom right quadrant (below right eye). 0-100 brightness. - * @returns {Promise} Resolved upon successful completion of command. + * @returns {Promise} Resolved upon successful issuance of the command. */ setBrightness(topLeft, bottomLeft, topRight, bottomRight) { this.writeDirect(0x05, Buffer.from([topLeft, topRight, bottomLeft, bottomRight])); @@ -183,7 +189,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicforcesensor.js.html b/docs/devices_technicforcesensor.js.html index 3d2c10e..994bb0d 100644 --- a/docs/devices_technicforcesensor.js.html +++ b/docs/devices_technicforcesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicForceSensor + * @extends Device + */ class TechnicForceSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_FORCE_SENSOR); @@ -99,8 +103,9 @@ class TechnicForceSensor extends device_1.Device { const force = message[4] / 10; /** * Emits when force is applied. - * @event TechnicForceSensor#force Force, in newtons (0-10). - * @param {number} force + * @event TechnicForceSensor#force + * @type {object} + * @param {number} force Force, in newtons (0-10). */ this.notify("force", { force }); break; @@ -108,8 +113,9 @@ class TechnicForceSensor extends device_1.Device { const touched = message[4] ? true : false; /** * Emits when the sensor is touched. - * @event TechnicForceSensor#touch Touched on/off (boolean). - * @param {boolean} touch + * @event TechnicForceSensor#touch + * @type {object} + * @param {boolean} touch Touched on/off (boolean). */ this.notify("touched", { touched }); break; @@ -117,8 +123,9 @@ class TechnicForceSensor extends device_1.Device { const tapped = message[4]; /** * Emits when the sensor is tapped. - * @event TechnicForceSensor#tapped How hard the sensor was tapped, from 0-3. - * @param {number} tapped + * @event TechnicForceSensor#tapped + * @type {object} + * @param {number} tapped How hard the sensor was tapped, from 0-3. */ this.notify("tapped", { tapped }); break; @@ -182,7 +189,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_techniclargeangularmotor.js.html b/docs/devices_techniclargeangularmotor.js.html new file mode 100644 index 0000000..0e6571a --- /dev/null +++ b/docs/devices_techniclargeangularmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/techniclargeangularmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/techniclargeangularmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicLargeAngularMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicLargeAngularMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_LARGE_ANGULAR_MOTOR);
+    }
+}
+exports.TechnicLargeAngularMotor = TechnicLargeAngularMotor;
+//# sourceMappingURL=techniclargeangularmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_techniclargelinearmotor.js.html b/docs/devices_techniclargelinearmotor.js.html new file mode 100644 index 0000000..83ab2d8 --- /dev/null +++ b/docs/devices_techniclargelinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/techniclargelinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/techniclargelinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicLargeLinearMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicLargeLinearMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR);
+    }
+}
+exports.TechnicLargeLinearMotor = TechnicLargeLinearMotor;
+//# sourceMappingURL=techniclargelinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumangularmotor.js.html b/docs/devices_technicmediumangularmotor.js.html new file mode 100644 index 0000000..22a2e71 --- /dev/null +++ b/docs/devices_technicmediumangularmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/technicmediumangularmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicmediumangularmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicMediumAngularMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicMediumAngularMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_MEDIUM_ANGULAR_MOTOR);
+    }
+}
+exports.TechnicMediumAngularMotor = TechnicMediumAngularMotor;
+//# sourceMappingURL=technicmediumangularmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_technicmediumhubaccelerometersensor.js.html b/docs/devices_technicmediumhubaccelerometersensor.js.html index a5b737f..85f89c0 100644 --- a/docs/devices_technicmediumhubaccelerometersensor.js.html +++ b/docs/devices_technicmediumhubaccelerometersensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicMediumHubAccelerometerSensor + * @extends Device + */ class TechnicMediumHubAccelerometerSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_ACCELEROMETER); @@ -98,8 +102,8 @@ class TechnicMediumHubAccelerometerSensor extends device_1.Device { case Mode.ACCEL: /** * Emits when accelerometer detects movement. Measured in mG. - * @event LPF2Hub#accel - * @param {string} port + * @event TechnicMediumHubAccelerometerSensor#accel + * @type {object} * @param {number} x * @param {number} y * @param {number} z @@ -165,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicmediumhubgyrosensor.js.html b/docs/devices_technicmediumhubgyrosensor.js.html index b267432..9ad8e5e 100644 --- a/docs/devices_technicmediumhubgyrosensor.js.html +++ b/docs/devices_technicmediumhubgyrosensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicMediumHubGyroSensor + * @extends Device + */ class TechnicMediumHubGyroSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_GYRO_SENSOR); @@ -99,6 +103,7 @@ class TechnicMediumHubGyroSensor extends device_1.Device { /** * Emits when gyroscope detects movement. Measured in DPS - degrees per second. * @event TechnicMediumHubGyroSensor#gyro + * @type {object} * @param {number} x * @param {number} y * @param {number} z @@ -164,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicmediumhubtiltsensor.js.html b/docs/devices_technicmediumhubtiltsensor.js.html index 0453b84..f6bbe48 100644 --- a/docs/devices_technicmediumhubtiltsensor.js.html +++ b/docs/devices_technicmediumhubtiltsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TechnicMediumHubTiltSensor + * @extends Device + */ class TechnicMediumHubTiltSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TECHNIC_MEDIUM_HUB_TILT_SENSOR); @@ -99,6 +103,7 @@ class TechnicMediumHubTiltSensor extends device_1.Device { /** * Emits when a tilt sensor is activated. * @event TechnicMediumHubTiltSensor#tilt + * @type {object} * @param {number} x * @param {number} y * @param {number} z @@ -164,7 +169,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_technicxlargelinearmotor.js.html b/docs/devices_technicxlargelinearmotor.js.html new file mode 100644 index 0000000..b3d40ca --- /dev/null +++ b/docs/devices_technicxlargelinearmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/technicxlargelinearmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/technicxlargelinearmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const absolutemotor_1 = require("./absolutemotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TechnicXLargeLinearMotor
+ * @extends AbsoluteMotor
+ */
+class TechnicXLargeLinearMotor extends absolutemotor_1.AbsoluteMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR);
+    }
+}
+exports.TechnicXLargeLinearMotor = TechnicXLargeLinearMotor;
+//# sourceMappingURL=technicxlargelinearmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_tiltsensor.js.html b/docs/devices_tiltsensor.js.html index 4c09882..5112b01 100644 --- a/docs/devices_tiltsensor.js.html +++ b/docs/devices_tiltsensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class TiltSensor + * @extends Device + */ class TiltSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.TILT_SENSOR); @@ -100,7 +104,8 @@ class TiltSensor extends device_1.Device { const y = message.readInt8(this.isWeDo2SmartHub ? 3 : 5); /** * Emits when a tilt sensor is activated. - * @event LPF2Hub#tilt + * @event TiltSensor#tilt + * @type {object} * @param {number} x * @param {number} y */ @@ -162,7 +167,7 @@ exports.ModeMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/devices_trainmotor.js.html b/docs/devices_trainmotor.js.html new file mode 100644 index 0000000..6ae8679 --- /dev/null +++ b/docs/devices_trainmotor.js.html @@ -0,0 +1,237 @@ + + + + + + + node-poweredup Source: devices/trainmotor.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: devices/trainmotor.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const basicmotor_1 = require("./basicmotor");
+const Consts = __importStar(require("../consts"));
+/**
+ * @class TrainMotor
+ * @extends BasicMotor
+ */
+class TrainMotor extends basicmotor_1.BasicMotor {
+    constructor(hub, portId) {
+        super(hub, portId, {}, Consts.DeviceType.TRAIN_MOTOR);
+    }
+}
+exports.TrainMotor = TrainMotor;
+//# sourceMappingURL=trainmotor.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/devices_voltagesensor.js.html b/docs/devices_voltagesensor.js.html index a341a20..e509767 100644 --- a/docs/devices_voltagesensor.js.html +++ b/docs/devices_voltagesensor.js.html @@ -33,14 +33,14 @@ @@ -88,6 +88,10 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const device_1 = require("./device"); const Consts = __importStar(require("../consts")); +/** + * @class VoltageSensor + * @extends Device + */ class VoltageSensor extends device_1.Device { constructor(hub, portId) { super(hub, portId, exports.ModeMap, Consts.DeviceType.VOLTAGE_SENSOR); @@ -113,6 +117,7 @@ class VoltageSensor extends device_1.Device { /** * Emits when a voltage change is detected. * @event VoltageSensor#voltage + * @type {object} * @param {number} voltage */ this.notify("voltage", { voltage }); @@ -185,7 +190,7 @@ const MaxVoltageRaw = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_basehub.js.html b/docs/hubs_basehub.js.html index af7ab7a..910438d 100644 --- a/docs/hubs_basehub.js.html +++ b/docs/hubs_basehub.js.html @@ -33,14 +33,14 @@ @@ -178,7 +178,7 @@ class BaseHub extends events_1.EventEmitter { } /** * @readonly - * @property {string} firmwareVersion Hardware version of the hub + * @property {string} hardwareVersion Hardware version of the hub */ get hardwareVersion() { return this._hardwareVersion; @@ -236,6 +236,12 @@ class BaseHub extends events_1.EventEmitter { disconnect() { return this._bleDevice.disconnect(); } + /** + * Retrieves the device attached to a given port. + * @method Hub#getDeviceAtPort + * @param {string} portName The name of the port to retrieve the device from. + * @returns {Device | undefined} The device attached to the port. + */ getDeviceAtPort(portName) { const portId = this._portMap[portName]; if (portId !== undefined) { @@ -245,6 +251,14 @@ class BaseHub extends events_1.EventEmitter { return undefined; } } + /** + * Retrieves the device attached to a given port, waiting until one is attached if there isn't one. + * + * Note: If a device is never attached, the returned promise may never resolve. + * @method Hub#waitForDeviceAtPort + * @param {string} portName The name of the port to retrieve the device from. + * @returns {Promise} Resolved once a device is attached, or resolved immediately if a device is already attached. + */ waitForDeviceAtPort(portName) { return new Promise((resolve) => { const existingDevice = this.getDeviceAtPort(portName); @@ -262,12 +276,31 @@ class BaseHub extends events_1.EventEmitter { }); }); } + /** + * Retrieves all attached devices. + * @method Hub#getDevices + * @returns {Device[]} Array of all attached devices. + */ getDevices() { return Object.values(this._attachedDevices); } + /** + * Retrieves an array of devices of the specified type. + * @method Hub#getDevicesByType + * @param {number} deviceType The device type to lookup. + * @returns {Device[]} Array of all devices of the specified type. + */ getDevicesByType(deviceType) { return this.getDevices().filter((device) => device.type === deviceType); } + /** + * Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one. + * + * Note: If a device is never attached, the returned promise may never resolve. + * @method Hub#waitForDeviceByType + * @param {number} deviceType The device type to lookup. + * @returns {Promise} Resolved once a device is attached, or resolved immediately if a device is already attached. + */ waitForDeviceByType(deviceType) { return new Promise((resolve) => { const existingDevices = this.getDevicesByType(deviceType); @@ -299,7 +332,7 @@ class BaseHub extends events_1.EventEmitter { /** * Sleep a given amount of time. * - * This is a helper method to make it easier to add delays into a chain of commands. + * Note: This is a helper method to make it easier to add delays into a chain of commands. * @method Hub#sleep * @param {number} delay How long to sleep (in milliseconds). * @returns {Promise} Resolved after the delay is finished. @@ -312,7 +345,7 @@ class BaseHub extends events_1.EventEmitter { /** * Wait until a given list of concurrently running commands are complete. * - * This is a helper method to make it easier to wait for concurrent commands to complete. + * Note: This is a helper method to make it easier to wait for concurrent commands to complete. * @method Hub#wait * @param {Array<Promise<any>>} commands Array of executing commands. * @returns {Promise} Resolved after the commands are finished. @@ -352,7 +385,7 @@ class BaseHub extends events_1.EventEmitter { delete this._attachedDevices[device.portId]; /** * Emits when a device is detached from the Hub. - * @event Hub#attach + * @event Hub#detach * @param {Device} device */ this.emit("detach", device); @@ -449,7 +482,7 @@ exports.BaseHub = BaseHub; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_boostmovehub.js.html b/docs/hubs_boostmovehub.js.html new file mode 100644 index 0000000..c4825ba --- /dev/null +++ b/docs/hubs_boostmovehub.js.html @@ -0,0 +1,276 @@ + + + + + + + node-poweredup Source: hubs/boostmovehub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/boostmovehub.js

+ +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const compare_versions_1 = __importDefault(require("compare-versions"));
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("boostmovehub");
+/**
+ * The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
+ * @class BoostMoveHub
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class BoostMoveHub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.BOOST_MOVE_HUB);
+        this._currentPort = 0x3b;
+        this._voltagePort = 0x3c;
+        this._portNames = {
+            "A": 0,
+            "B": 1,
+            "C": 2,
+            "D": 3,
+            "TILT": 58
+        };
+        debug("Discovered Boost Move Hub");
+    }
+    static IsBoostMoveHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.BOOST_MOVE_HUB_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Boost Move Hub");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+    _checkFirmware(version) {
+        if (compare_versions_1.default("2.0.00.0017", version) === 1) {
+            throw new Error(`Your Boost Move Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
+        }
+    }
+}
+exports.BoostMoveHub = BoostMoveHub;
+//# sourceMappingURL=boostmovehub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_controlplushub.js.html b/docs/hubs_controlplushub.js.html new file mode 100644 index 0000000..0070857 --- /dev/null +++ b/docs/hubs_controlplushub.js.html @@ -0,0 +1,273 @@ + + + + + + + node-poweredup Source: hubs/controlplushub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/controlplushub.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("ControlPlusHub");
+/**
+ * The ControlPlusHub is emitted if the discovered device is a Control+ Hub.
+ * @class ControlPlusHub
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class ControlPlusHub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.CONTROL_PLUS_HUB);
+        this._currentPort = 0x3b;
+        this._currentMaxMA = 4175;
+        this._voltagePort = 0x3c;
+        this._voltageMaxRaw = 4095;
+        this._voltageMaxV = 9.615;
+        this._portNames = {
+            "A": 0,
+            "B": 1,
+            "C": 2,
+            "D": 3,
+            "ACCEL": 97,
+            "GYRO": 98,
+            "TILT": 99
+        };
+        debug("Discovered Control+ Hub");
+    }
+    static IsControlPlusHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.CONTROL_PLUS_LARGE_HUB);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Control+ Hub");
+            await super.connect();
+            this.send(Buffer.from([0x41, 0x3d, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01]), Consts.BLECharacteristic.LPF2_ALL); // Temperature
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.ControlPlusHub = ControlPlusHub;
+//# sourceMappingURL=controlplushub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_duplotrainbase.js.html b/docs/hubs_duplotrainbase.js.html index 7d4c71b..5d53f26 100644 --- a/docs/hubs_duplotrainbase.js.html +++ b/docs/hubs_duplotrainbase.js.html @@ -33,14 +33,14 @@ @@ -169,7 +169,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_hub.js.html b/docs/hubs_hub.js.html index bf00f19..d02c5d4 100644 --- a/docs/hubs_hub.js.html +++ b/docs/hubs_hub.js.html @@ -33,14 +33,14 @@ @@ -181,7 +181,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_lpf2hub.js.html b/docs/hubs_lpf2hub.js.html index 13d46e8..574986c 100644 --- a/docs/hubs_lpf2hub.js.html +++ b/docs/hubs_lpf2hub.js.html @@ -33,14 +33,14 @@ @@ -164,6 +164,15 @@ class LPF2Hub extends basehub_1.BaseHub { unsubscribe(portId, mode) { this.send(Buffer.from([0x41, portId, mode, 0x01, 0x00, 0x00, 0x00, 0x00]), Consts.BLECharacteristic.LPF2_ALL); } + /** + * Combines two ports with into a single virtual port. + * + * Note: The devices attached to the ports must be of the same device type. + * @method LPF2Hub#createVirtualPort + * @param {string} firstPortName First port name + * @param {string} secondPortName Second port name + * @returns {Promise} Resolved upon successful issuance of command. + */ createVirtualPort(firstPortName, secondPortName) { const firstDevice = this.getDeviceAtPort(firstPortName); if (!firstDevice) { @@ -458,7 +467,7 @@ exports.LPF2Hub = LPF2Hub; Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_movehub.js.html b/docs/hubs_movehub.js.html index 8e2433e..6b3ed47 100644 --- a/docs/hubs_movehub.js.html +++ b/docs/hubs_movehub.js.html @@ -33,14 +33,14 @@ @@ -183,7 +183,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_puphub.js.html b/docs/hubs_puphub.js.html new file mode 100644 index 0000000..77b8ee4 --- /dev/null +++ b/docs/hubs_puphub.js.html @@ -0,0 +1,273 @@ + + + + + + + node-poweredup Source: hubs/puphub.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/puphub.js

+ +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const compare_versions_1 = __importDefault(require("compare-versions"));
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("puphub");
+/**
+ * The PUPHub is emitted if the discovered device is a Powered UP Hub.
+ * @class PUPHub
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class PUPHub extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.POWERED_UP_HUB);
+        this._currentPort = 0x3b;
+        this._voltagePort = 0x3c;
+        this._portNames = {
+            "A": 0,
+            "B": 1
+        };
+        debug("Discovered Powered UP Hub");
+    }
+    static IsPUPHub(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_HUB_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Powered UP Hub");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+    _checkFirmware(version) {
+        if (compare_versions_1.default("1.1.00.0004", version) === 1) {
+            throw new Error(`Your Powered Up Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
+        }
+    }
+}
+exports.PUPHub = PUPHub;
+//# sourceMappingURL=puphub.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_pupremote.js.html b/docs/hubs_pupremote.js.html new file mode 100644 index 0000000..688f36c --- /dev/null +++ b/docs/hubs_pupremote.js.html @@ -0,0 +1,266 @@ + + + + + + + node-poweredup Source: hubs/pupremote.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: hubs/pupremote.js

+ +
+
+
"use strict";
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const lpf2hub_1 = require("./lpf2hub");
+const Consts = __importStar(require("../consts"));
+const Debug = require("debug");
+const debug = Debug("pupremote");
+/**
+ * The PUPRemote is emitted if the discovered device is a Powered UP Remote.
+ * @class PUPRemote
+ * @extends LPF2Hub
+ * @extends Hub
+ */
+class PUPRemote extends lpf2hub_1.LPF2Hub {
+    constructor(device) {
+        super(device, Consts.HubType.POWERED_UP_REMOTE);
+        this._ledPort = 0x34;
+        this._voltagePort = 0x3b;
+        this._voltageMaxV = 6.4;
+        this._voltageMaxRaw = 3200;
+        this._portNames = {
+            "LEFT": 0,
+            "RIGHT": 1
+        };
+        debug("Discovered Powered UP Remote");
+    }
+    static IsPUPRemote(peripheral) {
+        return (peripheral.advertisement &&
+            peripheral.advertisement.serviceUuids &&
+            peripheral.advertisement.serviceUuids.indexOf(Consts.BLEService.LPF2_HUB.replace(/-/g, "")) >= 0 &&
+            peripheral.advertisement.manufacturerData &&
+            peripheral.advertisement.manufacturerData.length > 3 &&
+            peripheral.advertisement.manufacturerData[3] === Consts.BLEManufacturerData.POWERED_UP_REMOTE_ID);
+    }
+    connect() {
+        return new Promise(async (resolve, reject) => {
+            debug("Connecting to Powered UP Remote");
+            await super.connect();
+            debug("Connect completed");
+            return resolve();
+        });
+    }
+}
+exports.PUPRemote = PUPRemote;
+//# sourceMappingURL=pupremote.js.map
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/hubs_remotecontrol.js.html b/docs/hubs_remotecontrol.js.html index e46113a..ded1a63 100644 --- a/docs/hubs_remotecontrol.js.html +++ b/docs/hubs_remotecontrol.js.html @@ -33,14 +33,14 @@ @@ -171,7 +171,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_technicmediumhub.js.html b/docs/hubs_technicmediumhub.js.html index b5791f7..3adc0c0 100644 --- a/docs/hubs_technicmediumhub.js.html +++ b/docs/hubs_technicmediumhub.js.html @@ -33,14 +33,14 @@ @@ -177,7 +177,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/hubs_wedo2smarthub.js.html b/docs/hubs_wedo2smarthub.js.html index 724ce5e..87aa1ee 100644 --- a/docs/hubs_wedo2smarthub.js.html +++ b/docs/hubs_wedo2smarthub.js.html @@ -33,14 +33,14 @@ @@ -323,7 +323,7 @@ exports.PortMap = { Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/index.html b/docs/index.html index e99f5cd..118bca2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,14 +33,14 @@ @@ -358,7 +358,7 @@ console.log("Scanning for Hubs..."); Documentation generated by JSDoc 3.6.3 - on Fri Feb 7th 2020 + on Mon Feb 10th 2020 using the DocStrap template. diff --git a/docs/quicksearch.html b/docs/quicksearch.html index 942391b..95d7143 100644 --- a/docs/quicksearch.html +++ b/docs/quicksearch.html @@ -7,7 +7,7 @@