Docs maintain class hierarchy
This commit is contained in:
parent
2665879d19
commit
4db9a6528c
681
DOCS.md
681
DOCS.md
@ -354,19 +354,92 @@ Emits when an attached motor or sensor is detached from the Hub.
|
|||||||
|
|
||||||
## BoostMoveHub ⇐ <code>LPF2Hub</code>
|
## BoostMoveHub ⇐ <code>LPF2Hub</code>
|
||||||
**Kind**: global class
|
**Kind**: global class
|
||||||
**Extends**: <code>LPF2Hub</code>
|
**Extends**: <code>LPF2Hub</code>, <code>Hub</code>
|
||||||
|
|
||||||
* [BoostMoveHub](#BoostMoveHub) ⇐ <code>LPF2Hub</code>
|
* [BoostMoveHub](#BoostMoveHub) ⇐ <code>LPF2Hub</code>
|
||||||
* [new BoostMoveHub()](#new_BoostMoveHub_new)
|
* [new BoostMoveHub()](#new_BoostMoveHub_new)
|
||||||
|
* [.current](#LPF2Hub+current)
|
||||||
|
* [.name](#Hub+name)
|
||||||
|
* [.uuid](#Hub+uuid)
|
||||||
|
* [.rssi](#Hub+rssi)
|
||||||
|
* [.batteryLevel](#Hub+batteryLevel)
|
||||||
* [.setLEDColor(color)](#BoostMoveHub+setLEDColor) ⇒ <code>Promise</code>
|
* [.setLEDColor(color)](#BoostMoveHub+setLEDColor) ⇒ <code>Promise</code>
|
||||||
* [.setMotorSpeed(port, speed, [time])](#BoostMoveHub+setMotorSpeed) ⇒ <code>Promise</code>
|
* [.setMotorSpeed(port, speed, [time])](#BoostMoveHub+setMotorSpeed) ⇒ <code>Promise</code>
|
||||||
* [.setMotorAngle(port, angle, [speed])](#BoostMoveHub+setMotorAngle) ⇒ <code>Promise</code>
|
* [.setMotorAngle(port, angle, [speed])](#BoostMoveHub+setMotorAngle) ⇒ <code>Promise</code>
|
||||||
|
* [.connect()](#Hub+connect) ⇒ <code>Promise</code>
|
||||||
|
* [.disconnect()](#Hub+disconnect) ⇒ <code>Promise</code>
|
||||||
|
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
|
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
||||||
|
* ["color" (port, color)](#LPF2Hub+event_color)
|
||||||
|
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
||||||
|
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
||||||
|
* ["attach" (port, type)](#Hub+event_attach)
|
||||||
|
* ["detach" (port)](#Hub+event_detach)
|
||||||
|
|
||||||
<a name="new_BoostMoveHub_new"></a>
|
<a name="new_BoostMoveHub_new"></a>
|
||||||
|
|
||||||
### new BoostMoveHub()
|
### new BoostMoveHub()
|
||||||
The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
|
The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
|
||||||
|
|
||||||
|
<a name="LPF2Hub+current"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.current
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| current | <code>number</code> | Current usage of the hub (Amps) |
|
||||||
|
|
||||||
|
<a name="Hub+name"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.name
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| name | <code>string</code> | Name of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+uuid"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.uuid
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| uuid | <code>string</code> | UUID of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+rssi"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.rssi
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| rssi | <code>number</code> | Signal strength of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+batteryLevel"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.batteryLevel
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| batteryLevel | <code>number</code> | Battery level of the hub (Percentage between 0-100) |
|
||||||
|
|
||||||
<a name="BoostMoveHub+setLEDColor"></a>
|
<a name="BoostMoveHub+setLEDColor"></a>
|
||||||
|
|
||||||
### boostMoveHub.setLEDColor(color) ⇒ <code>Promise</code>
|
### boostMoveHub.setLEDColor(color) ⇒ <code>Promise</code>
|
||||||
@ -407,22 +480,247 @@ Rotate a motor by a given angle.
|
|||||||
| angle | <code>number</code> | | How much the motor should be rotated (in degrees). |
|
| angle | <code>number</code> | | How much the motor should be rotated (in degrees). |
|
||||||
| [speed] | <code>number</code> | <code>100</code> | How fast the motor should be rotated. |
|
| [speed] | <code>number</code> | <code>100</code> | How fast the motor should be rotated. |
|
||||||
|
|
||||||
|
<a name="Hub+connect"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.connect() ⇒ <code>Promise</code>
|
||||||
|
Connect to the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Overrides**: [<code>connect</code>](#Hub+connect)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful connect.
|
||||||
|
<a name="Hub+disconnect"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.disconnect() ⇒ <code>Promise</code>
|
||||||
|
Disconnect the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful disconnect.
|
||||||
|
<a name="Hub+subscribe"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.subscribe(port, [mode]) ⇒ <code>Promise</code>
|
||||||
|
Subscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| [mode] | <code>number</code> | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
|
||||||
|
|
||||||
|
<a name="Hub+unsubscribe"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.unsubscribe(port) ⇒ <code>Promise</code>
|
||||||
|
Unsubscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
<a name="Hub+sleep"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.sleep(delay) ⇒ <code>Promise</code>
|
||||||
|
Sleep a given amount of time.
|
||||||
|
|
||||||
|
This is a helper method to make it easier to add delays into a chain of commands.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the delay is finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| delay | <code>number</code> | How long to sleep (in milliseconds). |
|
||||||
|
|
||||||
|
<a name="Hub+wait"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.wait(commands) ⇒ <code>Promise</code>
|
||||||
|
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.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the commands are finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| commands | <code>Array.<Promise.<any>></code> | Array of executing commands. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_button"></a>
|
||||||
|
|
||||||
|
### "button" (button, state)
|
||||||
|
Emits when a button is pressed.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| button | <code>string</code> | |
|
||||||
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_distance"></a>
|
||||||
|
|
||||||
|
### "distance" (port, distance)
|
||||||
|
Emits when a distance sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| distance | <code>number</code> | Distance, in millimeters. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_color"></a>
|
||||||
|
|
||||||
|
### "color" (port, color)
|
||||||
|
Emits when a color sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_tilt"></a>
|
||||||
|
|
||||||
|
### "tilt" (port, x, y)
|
||||||
|
Emits when a tilt sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
||||||
|
| x | <code>number</code> | |
|
||||||
|
| y | <code>number</code> | |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_rotate"></a>
|
||||||
|
|
||||||
|
### "rotate" (port, rotation)
|
||||||
|
Emits when a rotation sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
| rotation | <code>number</code> |
|
||||||
|
|
||||||
|
<a name="Hub+event_attach"></a>
|
||||||
|
|
||||||
|
### "attach" (port, type)
|
||||||
|
Emits when a motor or sensor is attached to the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||||
|
|
||||||
|
<a name="Hub+event_detach"></a>
|
||||||
|
|
||||||
|
### "detach" (port)
|
||||||
|
Emits when an attached motor or sensor is detached from the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
<a name="PUPHub"></a>
|
<a name="PUPHub"></a>
|
||||||
|
|
||||||
## PUPHub ⇐ <code>LPF2Hub</code>
|
## PUPHub ⇐ <code>LPF2Hub</code>
|
||||||
**Kind**: global class
|
**Kind**: global class
|
||||||
**Extends**: <code>LPF2Hub</code>
|
**Extends**: <code>LPF2Hub</code>, <code>Hub</code>
|
||||||
|
|
||||||
* [PUPHub](#PUPHub) ⇐ <code>LPF2Hub</code>
|
* [PUPHub](#PUPHub) ⇐ <code>LPF2Hub</code>
|
||||||
* [new PUPHub()](#new_PUPHub_new)
|
* [new PUPHub()](#new_PUPHub_new)
|
||||||
|
* [.current](#LPF2Hub+current)
|
||||||
|
* [.name](#Hub+name)
|
||||||
|
* [.uuid](#Hub+uuid)
|
||||||
|
* [.rssi](#Hub+rssi)
|
||||||
|
* [.batteryLevel](#Hub+batteryLevel)
|
||||||
* [.setLEDColor(color)](#PUPHub+setLEDColor) ⇒ <code>Promise</code>
|
* [.setLEDColor(color)](#PUPHub+setLEDColor) ⇒ <code>Promise</code>
|
||||||
* [.setMotorSpeed(port, speed, [time])](#PUPHub+setMotorSpeed) ⇒ <code>Promise</code>
|
* [.setMotorSpeed(port, speed, [time])](#PUPHub+setMotorSpeed) ⇒ <code>Promise</code>
|
||||||
|
* [.connect()](#Hub+connect) ⇒ <code>Promise</code>
|
||||||
|
* [.disconnect()](#Hub+disconnect) ⇒ <code>Promise</code>
|
||||||
|
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
|
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
||||||
|
* ["color" (port, color)](#LPF2Hub+event_color)
|
||||||
|
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
||||||
|
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
||||||
|
* ["attach" (port, type)](#Hub+event_attach)
|
||||||
|
* ["detach" (port)](#Hub+event_detach)
|
||||||
|
|
||||||
<a name="new_PUPHub_new"></a>
|
<a name="new_PUPHub_new"></a>
|
||||||
|
|
||||||
### new PUPHub()
|
### new PUPHub()
|
||||||
The PUPHub is emitted if the discovered device is a Powered Up Hub.
|
The PUPHub is emitted if the discovered device is a Powered Up Hub.
|
||||||
|
|
||||||
|
<a name="LPF2Hub+current"></a>
|
||||||
|
|
||||||
|
### pupHub.current
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| current | <code>number</code> | Current usage of the hub (Amps) |
|
||||||
|
|
||||||
|
<a name="Hub+name"></a>
|
||||||
|
|
||||||
|
### pupHub.name
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| name | <code>string</code> | Name of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+uuid"></a>
|
||||||
|
|
||||||
|
### pupHub.uuid
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| uuid | <code>string</code> | UUID of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+rssi"></a>
|
||||||
|
|
||||||
|
### pupHub.rssi
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| rssi | <code>number</code> | Signal strength of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+batteryLevel"></a>
|
||||||
|
|
||||||
|
### pupHub.batteryLevel
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| batteryLevel | <code>number</code> | Battery level of the hub (Percentage between 0-100) |
|
||||||
|
|
||||||
<a name="PUPHub+setLEDColor"></a>
|
<a name="PUPHub+setLEDColor"></a>
|
||||||
|
|
||||||
### pupHub.setLEDColor(color) ⇒ <code>Promise</code>
|
### pupHub.setLEDColor(color) ⇒ <code>Promise</code>
|
||||||
@ -449,21 +747,246 @@ Set the motor speed on a given port.
|
|||||||
| speed | <code>number</code> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
|
| speed | <code>number</code> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
|
||||||
| [time] | <code>number</code> | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
|
| [time] | <code>number</code> | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
|
||||||
|
|
||||||
|
<a name="Hub+connect"></a>
|
||||||
|
|
||||||
|
### pupHub.connect() ⇒ <code>Promise</code>
|
||||||
|
Connect to the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Overrides**: [<code>connect</code>](#Hub+connect)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful connect.
|
||||||
|
<a name="Hub+disconnect"></a>
|
||||||
|
|
||||||
|
### pupHub.disconnect() ⇒ <code>Promise</code>
|
||||||
|
Disconnect the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful disconnect.
|
||||||
|
<a name="Hub+subscribe"></a>
|
||||||
|
|
||||||
|
### pupHub.subscribe(port, [mode]) ⇒ <code>Promise</code>
|
||||||
|
Subscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| [mode] | <code>number</code> | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
|
||||||
|
|
||||||
|
<a name="Hub+unsubscribe"></a>
|
||||||
|
|
||||||
|
### pupHub.unsubscribe(port) ⇒ <code>Promise</code>
|
||||||
|
Unsubscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
<a name="Hub+sleep"></a>
|
||||||
|
|
||||||
|
### pupHub.sleep(delay) ⇒ <code>Promise</code>
|
||||||
|
Sleep a given amount of time.
|
||||||
|
|
||||||
|
This is a helper method to make it easier to add delays into a chain of commands.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the delay is finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| delay | <code>number</code> | How long to sleep (in milliseconds). |
|
||||||
|
|
||||||
|
<a name="Hub+wait"></a>
|
||||||
|
|
||||||
|
### pupHub.wait(commands) ⇒ <code>Promise</code>
|
||||||
|
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.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the commands are finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| commands | <code>Array.<Promise.<any>></code> | Array of executing commands. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_button"></a>
|
||||||
|
|
||||||
|
### "button" (button, state)
|
||||||
|
Emits when a button is pressed.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| button | <code>string</code> | |
|
||||||
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_distance"></a>
|
||||||
|
|
||||||
|
### "distance" (port, distance)
|
||||||
|
Emits when a distance sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| distance | <code>number</code> | Distance, in millimeters. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_color"></a>
|
||||||
|
|
||||||
|
### "color" (port, color)
|
||||||
|
Emits when a color sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_tilt"></a>
|
||||||
|
|
||||||
|
### "tilt" (port, x, y)
|
||||||
|
Emits when a tilt sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
||||||
|
| x | <code>number</code> | |
|
||||||
|
| y | <code>number</code> | |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_rotate"></a>
|
||||||
|
|
||||||
|
### "rotate" (port, rotation)
|
||||||
|
Emits when a rotation sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
| rotation | <code>number</code> |
|
||||||
|
|
||||||
|
<a name="Hub+event_attach"></a>
|
||||||
|
|
||||||
|
### "attach" (port, type)
|
||||||
|
Emits when a motor or sensor is attached to the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||||
|
|
||||||
|
<a name="Hub+event_detach"></a>
|
||||||
|
|
||||||
|
### "detach" (port)
|
||||||
|
Emits when an attached motor or sensor is detached from the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
<a name="PUPRemote"></a>
|
<a name="PUPRemote"></a>
|
||||||
|
|
||||||
## PUPRemote ⇐ <code>LPF2Hub</code>
|
## PUPRemote ⇐ <code>LPF2Hub</code>
|
||||||
**Kind**: global class
|
**Kind**: global class
|
||||||
**Extends**: <code>LPF2Hub</code>
|
**Extends**: <code>LPF2Hub</code>, <code>Hub</code>
|
||||||
|
|
||||||
* [PUPRemote](#PUPRemote) ⇐ <code>LPF2Hub</code>
|
* [PUPRemote](#PUPRemote) ⇐ <code>LPF2Hub</code>
|
||||||
* [new PUPRemote()](#new_PUPRemote_new)
|
* [new PUPRemote()](#new_PUPRemote_new)
|
||||||
|
* [.current](#LPF2Hub+current)
|
||||||
|
* [.name](#Hub+name)
|
||||||
|
* [.uuid](#Hub+uuid)
|
||||||
|
* [.rssi](#Hub+rssi)
|
||||||
|
* [.batteryLevel](#Hub+batteryLevel)
|
||||||
* [.setLEDColor(color)](#PUPRemote+setLEDColor) ⇒ <code>Promise</code>
|
* [.setLEDColor(color)](#PUPRemote+setLEDColor) ⇒ <code>Promise</code>
|
||||||
|
* [.connect()](#Hub+connect) ⇒ <code>Promise</code>
|
||||||
|
* [.disconnect()](#Hub+disconnect) ⇒ <code>Promise</code>
|
||||||
|
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
|
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
||||||
|
* ["color" (port, color)](#LPF2Hub+event_color)
|
||||||
|
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
||||||
|
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
||||||
|
* ["attach" (port, type)](#Hub+event_attach)
|
||||||
|
* ["detach" (port)](#Hub+event_detach)
|
||||||
|
|
||||||
<a name="new_PUPRemote_new"></a>
|
<a name="new_PUPRemote_new"></a>
|
||||||
|
|
||||||
### new PUPRemote()
|
### new PUPRemote()
|
||||||
The PUPRemote is emitted if the discovered device is a Powered Up Remote.
|
The PUPRemote is emitted if the discovered device is a Powered Up Remote.
|
||||||
|
|
||||||
|
<a name="LPF2Hub+current"></a>
|
||||||
|
|
||||||
|
### pupRemote.current
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| current | <code>number</code> | Current usage of the hub (Amps) |
|
||||||
|
|
||||||
|
<a name="Hub+name"></a>
|
||||||
|
|
||||||
|
### pupRemote.name
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| name | <code>string</code> | Name of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+uuid"></a>
|
||||||
|
|
||||||
|
### pupRemote.uuid
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| uuid | <code>string</code> | UUID of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+rssi"></a>
|
||||||
|
|
||||||
|
### pupRemote.rssi
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| rssi | <code>number</code> | Signal strength of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+batteryLevel"></a>
|
||||||
|
|
||||||
|
### pupRemote.batteryLevel
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| batteryLevel | <code>number</code> | Battery level of the hub (Percentage between 0-100) |
|
||||||
|
|
||||||
<a name="PUPRemote+setLEDColor"></a>
|
<a name="PUPRemote+setLEDColor"></a>
|
||||||
|
|
||||||
### pupRemote.setLEDColor(color) ⇒ <code>Promise</code>
|
### pupRemote.setLEDColor(color) ⇒ <code>Promise</code>
|
||||||
@ -476,3 +999,155 @@ Set the color of the LED on the Remote via a color value.
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="Hub+connect"></a>
|
||||||
|
|
||||||
|
### pupRemote.connect() ⇒ <code>Promise</code>
|
||||||
|
Connect to the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Overrides**: [<code>connect</code>](#Hub+connect)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful connect.
|
||||||
|
<a name="Hub+disconnect"></a>
|
||||||
|
|
||||||
|
### pupRemote.disconnect() ⇒ <code>Promise</code>
|
||||||
|
Disconnect the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful disconnect.
|
||||||
|
<a name="Hub+subscribe"></a>
|
||||||
|
|
||||||
|
### pupRemote.subscribe(port, [mode]) ⇒ <code>Promise</code>
|
||||||
|
Subscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| [mode] | <code>number</code> | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
|
||||||
|
|
||||||
|
<a name="Hub+unsubscribe"></a>
|
||||||
|
|
||||||
|
### pupRemote.unsubscribe(port) ⇒ <code>Promise</code>
|
||||||
|
Unsubscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
<a name="Hub+sleep"></a>
|
||||||
|
|
||||||
|
### pupRemote.sleep(delay) ⇒ <code>Promise</code>
|
||||||
|
Sleep a given amount of time.
|
||||||
|
|
||||||
|
This is a helper method to make it easier to add delays into a chain of commands.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the delay is finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| delay | <code>number</code> | How long to sleep (in milliseconds). |
|
||||||
|
|
||||||
|
<a name="Hub+wait"></a>
|
||||||
|
|
||||||
|
### pupRemote.wait(commands) ⇒ <code>Promise</code>
|
||||||
|
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.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the commands are finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| commands | <code>Array.<Promise.<any>></code> | Array of executing commands. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_button"></a>
|
||||||
|
|
||||||
|
### "button" (button, state)
|
||||||
|
Emits when a button is pressed.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| button | <code>string</code> | |
|
||||||
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_distance"></a>
|
||||||
|
|
||||||
|
### "distance" (port, distance)
|
||||||
|
Emits when a distance sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| distance | <code>number</code> | Distance, in millimeters. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_color"></a>
|
||||||
|
|
||||||
|
### "color" (port, color)
|
||||||
|
Emits when a color sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_tilt"></a>
|
||||||
|
|
||||||
|
### "tilt" (port, x, y)
|
||||||
|
Emits when a tilt sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
||||||
|
| x | <code>number</code> | |
|
||||||
|
| y | <code>number</code> | |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_rotate"></a>
|
||||||
|
|
||||||
|
### "rotate" (port, rotation)
|
||||||
|
Emits when a rotation sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
| rotation | <code>number</code> |
|
||||||
|
|
||||||
|
<a name="Hub+event_attach"></a>
|
||||||
|
|
||||||
|
### "attach" (port, type)
|
||||||
|
Emits when a motor or sensor is attached to the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||||
|
|
||||||
|
<a name="Hub+event_detach"></a>
|
||||||
|
|
||||||
|
### "detach" (port)
|
||||||
|
Emits when an attached motor or sensor is detached from the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
681
README.md
681
README.md
@ -404,19 +404,92 @@ Emits when an attached motor or sensor is detached from the Hub.
|
|||||||
|
|
||||||
## BoostMoveHub ⇐ <code>LPF2Hub</code>
|
## BoostMoveHub ⇐ <code>LPF2Hub</code>
|
||||||
**Kind**: global class
|
**Kind**: global class
|
||||||
**Extends**: <code>LPF2Hub</code>
|
**Extends**: <code>LPF2Hub</code>, <code>Hub</code>
|
||||||
|
|
||||||
* [BoostMoveHub](#BoostMoveHub) ⇐ <code>LPF2Hub</code>
|
* [BoostMoveHub](#BoostMoveHub) ⇐ <code>LPF2Hub</code>
|
||||||
* [new BoostMoveHub()](#new_BoostMoveHub_new)
|
* [new BoostMoveHub()](#new_BoostMoveHub_new)
|
||||||
|
* [.current](#LPF2Hub+current)
|
||||||
|
* [.name](#Hub+name)
|
||||||
|
* [.uuid](#Hub+uuid)
|
||||||
|
* [.rssi](#Hub+rssi)
|
||||||
|
* [.batteryLevel](#Hub+batteryLevel)
|
||||||
* [.setLEDColor(color)](#BoostMoveHub+setLEDColor) ⇒ <code>Promise</code>
|
* [.setLEDColor(color)](#BoostMoveHub+setLEDColor) ⇒ <code>Promise</code>
|
||||||
* [.setMotorSpeed(port, speed, [time])](#BoostMoveHub+setMotorSpeed) ⇒ <code>Promise</code>
|
* [.setMotorSpeed(port, speed, [time])](#BoostMoveHub+setMotorSpeed) ⇒ <code>Promise</code>
|
||||||
* [.setMotorAngle(port, angle, [speed])](#BoostMoveHub+setMotorAngle) ⇒ <code>Promise</code>
|
* [.setMotorAngle(port, angle, [speed])](#BoostMoveHub+setMotorAngle) ⇒ <code>Promise</code>
|
||||||
|
* [.connect()](#Hub+connect) ⇒ <code>Promise</code>
|
||||||
|
* [.disconnect()](#Hub+disconnect) ⇒ <code>Promise</code>
|
||||||
|
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
|
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
||||||
|
* ["color" (port, color)](#LPF2Hub+event_color)
|
||||||
|
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
||||||
|
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
||||||
|
* ["attach" (port, type)](#Hub+event_attach)
|
||||||
|
* ["detach" (port)](#Hub+event_detach)
|
||||||
|
|
||||||
<a name="new_BoostMoveHub_new"></a>
|
<a name="new_BoostMoveHub_new"></a>
|
||||||
|
|
||||||
### new BoostMoveHub()
|
### new BoostMoveHub()
|
||||||
The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
|
The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
|
||||||
|
|
||||||
|
<a name="LPF2Hub+current"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.current
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| current | <code>number</code> | Current usage of the hub (Amps) |
|
||||||
|
|
||||||
|
<a name="Hub+name"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.name
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| name | <code>string</code> | Name of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+uuid"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.uuid
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| uuid | <code>string</code> | UUID of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+rssi"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.rssi
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| rssi | <code>number</code> | Signal strength of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+batteryLevel"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.batteryLevel
|
||||||
|
**Kind**: instance property of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| batteryLevel | <code>number</code> | Battery level of the hub (Percentage between 0-100) |
|
||||||
|
|
||||||
<a name="BoostMoveHub+setLEDColor"></a>
|
<a name="BoostMoveHub+setLEDColor"></a>
|
||||||
|
|
||||||
### boostMoveHub.setLEDColor(color) ⇒ <code>Promise</code>
|
### boostMoveHub.setLEDColor(color) ⇒ <code>Promise</code>
|
||||||
@ -457,22 +530,247 @@ Rotate a motor by a given angle.
|
|||||||
| angle | <code>number</code> | | How much the motor should be rotated (in degrees). |
|
| angle | <code>number</code> | | How much the motor should be rotated (in degrees). |
|
||||||
| [speed] | <code>number</code> | <code>100</code> | How fast the motor should be rotated. |
|
| [speed] | <code>number</code> | <code>100</code> | How fast the motor should be rotated. |
|
||||||
|
|
||||||
|
<a name="Hub+connect"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.connect() ⇒ <code>Promise</code>
|
||||||
|
Connect to the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Overrides**: [<code>connect</code>](#Hub+connect)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful connect.
|
||||||
|
<a name="Hub+disconnect"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.disconnect() ⇒ <code>Promise</code>
|
||||||
|
Disconnect the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful disconnect.
|
||||||
|
<a name="Hub+subscribe"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.subscribe(port, [mode]) ⇒ <code>Promise</code>
|
||||||
|
Subscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| [mode] | <code>number</code> | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
|
||||||
|
|
||||||
|
<a name="Hub+unsubscribe"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.unsubscribe(port) ⇒ <code>Promise</code>
|
||||||
|
Unsubscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
<a name="Hub+sleep"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.sleep(delay) ⇒ <code>Promise</code>
|
||||||
|
Sleep a given amount of time.
|
||||||
|
|
||||||
|
This is a helper method to make it easier to add delays into a chain of commands.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the delay is finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| delay | <code>number</code> | How long to sleep (in milliseconds). |
|
||||||
|
|
||||||
|
<a name="Hub+wait"></a>
|
||||||
|
|
||||||
|
### boostMoveHub.wait(commands) ⇒ <code>Promise</code>
|
||||||
|
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.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the commands are finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| commands | <code>Array.<Promise.<any>></code> | Array of executing commands. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_button"></a>
|
||||||
|
|
||||||
|
### "button" (button, state)
|
||||||
|
Emits when a button is pressed.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| button | <code>string</code> | |
|
||||||
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_distance"></a>
|
||||||
|
|
||||||
|
### "distance" (port, distance)
|
||||||
|
Emits when a distance sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| distance | <code>number</code> | Distance, in millimeters. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_color"></a>
|
||||||
|
|
||||||
|
### "color" (port, color)
|
||||||
|
Emits when a color sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_tilt"></a>
|
||||||
|
|
||||||
|
### "tilt" (port, x, y)
|
||||||
|
Emits when a tilt sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
||||||
|
| x | <code>number</code> | |
|
||||||
|
| y | <code>number</code> | |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_rotate"></a>
|
||||||
|
|
||||||
|
### "rotate" (port, rotation)
|
||||||
|
Emits when a rotation sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
| rotation | <code>number</code> |
|
||||||
|
|
||||||
|
<a name="Hub+event_attach"></a>
|
||||||
|
|
||||||
|
### "attach" (port, type)
|
||||||
|
Emits when a motor or sensor is attached to the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||||
|
|
||||||
|
<a name="Hub+event_detach"></a>
|
||||||
|
|
||||||
|
### "detach" (port)
|
||||||
|
Emits when an attached motor or sensor is detached from the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>BoostMoveHub</code>](#BoostMoveHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
<a name="PUPHub"></a>
|
<a name="PUPHub"></a>
|
||||||
|
|
||||||
## PUPHub ⇐ <code>LPF2Hub</code>
|
## PUPHub ⇐ <code>LPF2Hub</code>
|
||||||
**Kind**: global class
|
**Kind**: global class
|
||||||
**Extends**: <code>LPF2Hub</code>
|
**Extends**: <code>LPF2Hub</code>, <code>Hub</code>
|
||||||
|
|
||||||
* [PUPHub](#PUPHub) ⇐ <code>LPF2Hub</code>
|
* [PUPHub](#PUPHub) ⇐ <code>LPF2Hub</code>
|
||||||
* [new PUPHub()](#new_PUPHub_new)
|
* [new PUPHub()](#new_PUPHub_new)
|
||||||
|
* [.current](#LPF2Hub+current)
|
||||||
|
* [.name](#Hub+name)
|
||||||
|
* [.uuid](#Hub+uuid)
|
||||||
|
* [.rssi](#Hub+rssi)
|
||||||
|
* [.batteryLevel](#Hub+batteryLevel)
|
||||||
* [.setLEDColor(color)](#PUPHub+setLEDColor) ⇒ <code>Promise</code>
|
* [.setLEDColor(color)](#PUPHub+setLEDColor) ⇒ <code>Promise</code>
|
||||||
* [.setMotorSpeed(port, speed, [time])](#PUPHub+setMotorSpeed) ⇒ <code>Promise</code>
|
* [.setMotorSpeed(port, speed, [time])](#PUPHub+setMotorSpeed) ⇒ <code>Promise</code>
|
||||||
|
* [.connect()](#Hub+connect) ⇒ <code>Promise</code>
|
||||||
|
* [.disconnect()](#Hub+disconnect) ⇒ <code>Promise</code>
|
||||||
|
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
|
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
||||||
|
* ["color" (port, color)](#LPF2Hub+event_color)
|
||||||
|
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
||||||
|
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
||||||
|
* ["attach" (port, type)](#Hub+event_attach)
|
||||||
|
* ["detach" (port)](#Hub+event_detach)
|
||||||
|
|
||||||
<a name="new_PUPHub_new"></a>
|
<a name="new_PUPHub_new"></a>
|
||||||
|
|
||||||
### new PUPHub()
|
### new PUPHub()
|
||||||
The PUPHub is emitted if the discovered device is a Powered Up Hub.
|
The PUPHub is emitted if the discovered device is a Powered Up Hub.
|
||||||
|
|
||||||
|
<a name="LPF2Hub+current"></a>
|
||||||
|
|
||||||
|
### pupHub.current
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| current | <code>number</code> | Current usage of the hub (Amps) |
|
||||||
|
|
||||||
|
<a name="Hub+name"></a>
|
||||||
|
|
||||||
|
### pupHub.name
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| name | <code>string</code> | Name of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+uuid"></a>
|
||||||
|
|
||||||
|
### pupHub.uuid
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| uuid | <code>string</code> | UUID of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+rssi"></a>
|
||||||
|
|
||||||
|
### pupHub.rssi
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| rssi | <code>number</code> | Signal strength of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+batteryLevel"></a>
|
||||||
|
|
||||||
|
### pupHub.batteryLevel
|
||||||
|
**Kind**: instance property of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| batteryLevel | <code>number</code> | Battery level of the hub (Percentage between 0-100) |
|
||||||
|
|
||||||
<a name="PUPHub+setLEDColor"></a>
|
<a name="PUPHub+setLEDColor"></a>
|
||||||
|
|
||||||
### pupHub.setLEDColor(color) ⇒ <code>Promise</code>
|
### pupHub.setLEDColor(color) ⇒ <code>Promise</code>
|
||||||
@ -499,21 +797,246 @@ Set the motor speed on a given port.
|
|||||||
| speed | <code>number</code> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
|
| speed | <code>number</code> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
|
||||||
| [time] | <code>number</code> | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
|
| [time] | <code>number</code> | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
|
||||||
|
|
||||||
|
<a name="Hub+connect"></a>
|
||||||
|
|
||||||
|
### pupHub.connect() ⇒ <code>Promise</code>
|
||||||
|
Connect to the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Overrides**: [<code>connect</code>](#Hub+connect)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful connect.
|
||||||
|
<a name="Hub+disconnect"></a>
|
||||||
|
|
||||||
|
### pupHub.disconnect() ⇒ <code>Promise</code>
|
||||||
|
Disconnect the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful disconnect.
|
||||||
|
<a name="Hub+subscribe"></a>
|
||||||
|
|
||||||
|
### pupHub.subscribe(port, [mode]) ⇒ <code>Promise</code>
|
||||||
|
Subscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| [mode] | <code>number</code> | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
|
||||||
|
|
||||||
|
<a name="Hub+unsubscribe"></a>
|
||||||
|
|
||||||
|
### pupHub.unsubscribe(port) ⇒ <code>Promise</code>
|
||||||
|
Unsubscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
<a name="Hub+sleep"></a>
|
||||||
|
|
||||||
|
### pupHub.sleep(delay) ⇒ <code>Promise</code>
|
||||||
|
Sleep a given amount of time.
|
||||||
|
|
||||||
|
This is a helper method to make it easier to add delays into a chain of commands.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the delay is finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| delay | <code>number</code> | How long to sleep (in milliseconds). |
|
||||||
|
|
||||||
|
<a name="Hub+wait"></a>
|
||||||
|
|
||||||
|
### pupHub.wait(commands) ⇒ <code>Promise</code>
|
||||||
|
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.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPHub</code>](#PUPHub)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the commands are finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| commands | <code>Array.<Promise.<any>></code> | Array of executing commands. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_button"></a>
|
||||||
|
|
||||||
|
### "button" (button, state)
|
||||||
|
Emits when a button is pressed.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| button | <code>string</code> | |
|
||||||
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_distance"></a>
|
||||||
|
|
||||||
|
### "distance" (port, distance)
|
||||||
|
Emits when a distance sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| distance | <code>number</code> | Distance, in millimeters. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_color"></a>
|
||||||
|
|
||||||
|
### "color" (port, color)
|
||||||
|
Emits when a color sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_tilt"></a>
|
||||||
|
|
||||||
|
### "tilt" (port, x, y)
|
||||||
|
Emits when a tilt sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
||||||
|
| x | <code>number</code> | |
|
||||||
|
| y | <code>number</code> | |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_rotate"></a>
|
||||||
|
|
||||||
|
### "rotate" (port, rotation)
|
||||||
|
Emits when a rotation sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
| rotation | <code>number</code> |
|
||||||
|
|
||||||
|
<a name="Hub+event_attach"></a>
|
||||||
|
|
||||||
|
### "attach" (port, type)
|
||||||
|
Emits when a motor or sensor is attached to the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||||
|
|
||||||
|
<a name="Hub+event_detach"></a>
|
||||||
|
|
||||||
|
### "detach" (port)
|
||||||
|
Emits when an attached motor or sensor is detached from the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPHub</code>](#PUPHub)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
<a name="PUPRemote"></a>
|
<a name="PUPRemote"></a>
|
||||||
|
|
||||||
## PUPRemote ⇐ <code>LPF2Hub</code>
|
## PUPRemote ⇐ <code>LPF2Hub</code>
|
||||||
**Kind**: global class
|
**Kind**: global class
|
||||||
**Extends**: <code>LPF2Hub</code>
|
**Extends**: <code>LPF2Hub</code>, <code>Hub</code>
|
||||||
|
|
||||||
* [PUPRemote](#PUPRemote) ⇐ <code>LPF2Hub</code>
|
* [PUPRemote](#PUPRemote) ⇐ <code>LPF2Hub</code>
|
||||||
* [new PUPRemote()](#new_PUPRemote_new)
|
* [new PUPRemote()](#new_PUPRemote_new)
|
||||||
|
* [.current](#LPF2Hub+current)
|
||||||
|
* [.name](#Hub+name)
|
||||||
|
* [.uuid](#Hub+uuid)
|
||||||
|
* [.rssi](#Hub+rssi)
|
||||||
|
* [.batteryLevel](#Hub+batteryLevel)
|
||||||
* [.setLEDColor(color)](#PUPRemote+setLEDColor) ⇒ <code>Promise</code>
|
* [.setLEDColor(color)](#PUPRemote+setLEDColor) ⇒ <code>Promise</code>
|
||||||
|
* [.connect()](#Hub+connect) ⇒ <code>Promise</code>
|
||||||
|
* [.disconnect()](#Hub+disconnect) ⇒ <code>Promise</code>
|
||||||
|
* [.subscribe(port, [mode])](#Hub+subscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.unsubscribe(port)](#Hub+unsubscribe) ⇒ <code>Promise</code>
|
||||||
|
* [.sleep(delay)](#Hub+sleep) ⇒ <code>Promise</code>
|
||||||
|
* [.wait(commands)](#Hub+wait) ⇒ <code>Promise</code>
|
||||||
|
* ["button" (button, state)](#LPF2Hub+event_button)
|
||||||
|
* ["distance" (port, distance)](#LPF2Hub+event_distance)
|
||||||
|
* ["color" (port, color)](#LPF2Hub+event_color)
|
||||||
|
* ["tilt" (port, x, y)](#LPF2Hub+event_tilt)
|
||||||
|
* ["rotate" (port, rotation)](#LPF2Hub+event_rotate)
|
||||||
|
* ["attach" (port, type)](#Hub+event_attach)
|
||||||
|
* ["detach" (port)](#Hub+event_detach)
|
||||||
|
|
||||||
<a name="new_PUPRemote_new"></a>
|
<a name="new_PUPRemote_new"></a>
|
||||||
|
|
||||||
### new PUPRemote()
|
### new PUPRemote()
|
||||||
The PUPRemote is emitted if the discovered device is a Powered Up Remote.
|
The PUPRemote is emitted if the discovered device is a Powered Up Remote.
|
||||||
|
|
||||||
|
<a name="LPF2Hub+current"></a>
|
||||||
|
|
||||||
|
### pupRemote.current
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| current | <code>number</code> | Current usage of the hub (Amps) |
|
||||||
|
|
||||||
|
<a name="Hub+name"></a>
|
||||||
|
|
||||||
|
### pupRemote.name
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| name | <code>string</code> | Name of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+uuid"></a>
|
||||||
|
|
||||||
|
### pupRemote.uuid
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| uuid | <code>string</code> | UUID of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+rssi"></a>
|
||||||
|
|
||||||
|
### pupRemote.rssi
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| rssi | <code>number</code> | Signal strength of the hub |
|
||||||
|
|
||||||
|
<a name="Hub+batteryLevel"></a>
|
||||||
|
|
||||||
|
### pupRemote.batteryLevel
|
||||||
|
**Kind**: instance property of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Read only**: true
|
||||||
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| batteryLevel | <code>number</code> | Battery level of the hub (Percentage between 0-100) |
|
||||||
|
|
||||||
<a name="PUPRemote+setLEDColor"></a>
|
<a name="PUPRemote+setLEDColor"></a>
|
||||||
|
|
||||||
### pupRemote.setLEDColor(color) ⇒ <code>Promise</code>
|
### pupRemote.setLEDColor(color) ⇒ <code>Promise</code>
|
||||||
@ -526,3 +1049,155 @@ Set the color of the LED on the Remote via a color value.
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="Hub+connect"></a>
|
||||||
|
|
||||||
|
### pupRemote.connect() ⇒ <code>Promise</code>
|
||||||
|
Connect to the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Overrides**: [<code>connect</code>](#Hub+connect)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful connect.
|
||||||
|
<a name="Hub+disconnect"></a>
|
||||||
|
|
||||||
|
### pupRemote.disconnect() ⇒ <code>Promise</code>
|
||||||
|
Disconnect the Hub.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful disconnect.
|
||||||
|
<a name="Hub+subscribe"></a>
|
||||||
|
|
||||||
|
### pupRemote.subscribe(port, [mode]) ⇒ <code>Promise</code>
|
||||||
|
Subscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| [mode] | <code>number</code> | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
|
||||||
|
|
||||||
|
<a name="Hub+unsubscribe"></a>
|
||||||
|
|
||||||
|
### pupRemote.unsubscribe(port) ⇒ <code>Promise</code>
|
||||||
|
Unsubscribe to sensor notifications on a given port.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved upon successful issuance of command.
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
<a name="Hub+sleep"></a>
|
||||||
|
|
||||||
|
### pupRemote.sleep(delay) ⇒ <code>Promise</code>
|
||||||
|
Sleep a given amount of time.
|
||||||
|
|
||||||
|
This is a helper method to make it easier to add delays into a chain of commands.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the delay is finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| delay | <code>number</code> | How long to sleep (in milliseconds). |
|
||||||
|
|
||||||
|
<a name="Hub+wait"></a>
|
||||||
|
|
||||||
|
### pupRemote.wait(commands) ⇒ <code>Promise</code>
|
||||||
|
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.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
**Returns**: <code>Promise</code> - Resolved after the commands are finished.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| commands | <code>Array.<Promise.<any>></code> | Array of executing commands. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_button"></a>
|
||||||
|
|
||||||
|
### "button" (button, state)
|
||||||
|
Emits when a button is pressed.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| button | <code>string</code> | |
|
||||||
|
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_distance"></a>
|
||||||
|
|
||||||
|
### "distance" (port, distance)
|
||||||
|
Emits when a distance sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| distance | <code>number</code> | Distance, in millimeters. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_color"></a>
|
||||||
|
|
||||||
|
### "color" (port, color)
|
||||||
|
Emits when a color sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_tilt"></a>
|
||||||
|
|
||||||
|
### "tilt" (port, x, y)
|
||||||
|
Emits when a tilt sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
|
||||||
|
| x | <code>number</code> | |
|
||||||
|
| y | <code>number</code> | |
|
||||||
|
|
||||||
|
<a name="LPF2Hub+event_rotate"></a>
|
||||||
|
|
||||||
|
### "rotate" (port, rotation)
|
||||||
|
Emits when a rotation sensor is activated.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
| rotation | <code>number</code> |
|
||||||
|
|
||||||
|
<a name="Hub+event_attach"></a>
|
||||||
|
|
||||||
|
### "attach" (port, type)
|
||||||
|
Emits when a motor or sensor is attached to the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| port | <code>string</code> | |
|
||||||
|
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||||
|
|
||||||
|
<a name="Hub+event_detach"></a>
|
||||||
|
|
||||||
|
### "detach" (port)
|
||||||
|
Emits when an attached motor or sensor is detached from the Hub.
|
||||||
|
|
||||||
|
**Kind**: event emitted by [<code>PUPRemote</code>](#PUPRemote)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| port | <code>string</code> |
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ const debug = Debug("lpf2hub");
|
|||||||
* The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
|
* The BoostMoveHub is emitted if the discovered device is a Boost Move Hub.
|
||||||
* @class BoostMoveHub
|
* @class BoostMoveHub
|
||||||
* @extends LPF2Hub
|
* @extends LPF2Hub
|
||||||
|
* @extends Hub
|
||||||
*/
|
*/
|
||||||
export class BoostMoveHub extends LPF2Hub {
|
export class BoostMoveHub extends LPF2Hub {
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"types": "dist/lpf2.d.ts",
|
"types": "dist/lpf2.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tslint -c tslint.json \"*.ts\" && tsc",
|
"build": "tslint -c tslint.json \"*.ts\" && tsc",
|
||||||
"docs": "jsdoc2md dist/lpf2.js dist/wedo2hub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/hub.js dist/consts.js > DOCS.md",
|
"docs": "jsdoc2md dist/lpf2.js dist/lpf2hub.js dist/wedo2hub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/hub.js dist/consts.js > DOCS.md",
|
||||||
"readme": "cat ABOUT.md DOCS.md > README.md",
|
"readme": "cat ABOUT.md DOCS.md > README.md",
|
||||||
"all": "npm run build && npm run docs && npm run readme",
|
"all": "npm run build && npm run docs && npm run readme",
|
||||||
"prepublishOnly": "tsc"
|
"prepublishOnly": "tsc"
|
||||||
|
@ -13,6 +13,7 @@ const debug = Debug("lpf2hub");
|
|||||||
* The PUPHub is emitted if the discovered device is a Powered Up Hub.
|
* The PUPHub is emitted if the discovered device is a Powered Up Hub.
|
||||||
* @class PUPHub
|
* @class PUPHub
|
||||||
* @extends LPF2Hub
|
* @extends LPF2Hub
|
||||||
|
* @extends Hub
|
||||||
*/
|
*/
|
||||||
export class PUPHub extends LPF2Hub {
|
export class PUPHub extends LPF2Hub {
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ const debug = Debug("lpf2hub");
|
|||||||
* The PUPRemote is emitted if the discovered device is a Powered Up Remote.
|
* The PUPRemote is emitted if the discovered device is a Powered Up Remote.
|
||||||
* @class PUPRemote
|
* @class PUPRemote
|
||||||
* @extends LPF2Hub
|
* @extends LPF2Hub
|
||||||
|
* @extends Hub
|
||||||
*/
|
*/
|
||||||
export class PUPRemote extends LPF2Hub {
|
export class PUPRemote extends LPF2Hub {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user