14 KiB
Classes
LPF2 ⇐ EventEmitter
Kind: global class
Extends: EventEmitter
- LPF2 ⇐
EventEmitter
lpF2.scan()
Begin scanning for LPF2 Hub devices.
Kind: instance method of LPF2
lpF2.scan()
Stop scanning for LPF2 Hub devices.
Kind: instance method of LPF2
lpF2.getConnectedDeviceByUUID(uuid) ⇒ Hub
| null
Retrieve a LPF2 Hub device by UUID
Kind: instance method of LPF2
Param | Type |
---|---|
uuid | string |
lpF2.getConnectedDevices() ⇒ Array.<Hub>
Retrieve a list of LPF2 Hub devices
Kind: instance method of LPF2
"discover" (hub)
Emits when a LPF2 Hub device is found.
Kind: event emitted by LPF2
Param | Type |
---|---|
hub | Hub |
BoostHub ⇐ Hub
Kind: global class
Extends: Hub
- BoostHub ⇐
Hub
- .setLEDColor(color) ⇒
Promise
- .setMotorSpeed(port, speed, [time]) ⇒
Promise
- .setMotorAngle(port, angle, [speed]) ⇒
Promise
- .connect() ⇒
Promise
- .disconnect()
- .subscribe(port, [mode])
- .unsubscribe(port)
- "button" (button, state)
- "distance" (port, distance)
- "color" (port, color)
- "tilt" (port, x, y)
- "rotate" (port, rotation)
- .setLEDColor(color) ⇒
boostHub.setLEDColor(color) ⇒ Promise
Set the color of the LED on the Hub via a color value.
Kind: instance method of BoostHub
Returns: Promise
- Resolved upon successful completion of command.
Param | Type | Description |
---|---|---|
color | number |
A number representing one of the LED color consts. |
boostHub.setMotorSpeed(port, speed, [time]) ⇒ Promise
Set the motor speed on a given port.
Kind: instance method of BoostHub
Returns: Promise
- Resolved upon successful completion of command. If time is specified, this is once the motor is finished.
Param | Type | Description |
---|---|---|
port | string |
|
speed | number |
For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
[time] | number |
How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. |
boostHub.setMotorAngle(port, angle, [speed]) ⇒ Promise
Rotate a motor by a given angle.
Kind: instance method of BoostHub
Returns: Promise
- Resolved upon successful completion of command (ie. once the motor is finished).
Param | Type | Default | Description |
---|---|---|---|
port | string |
||
angle | number |
How much the motor should be rotated (in degrees). | |
[speed] | number |
100 |
How fast the motor should be rotated. |
boostHub.connect() ⇒ Promise
Connect to the Hub.
Kind: instance method of BoostHub
Overrides: connect
Returns: Promise
- Resolved when successfully connected.
boostHub.disconnect()
Disconnect the Hub.
Kind: instance method of BoostHub
boostHub.subscribe(port, [mode])
Subscribe to sensor notifications on a given port.
Kind: instance method of BoostHub
Param | Type | Default | Description |
---|---|---|---|
port | string |
||
[mode] | number | boolean |
false |
The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
boostHub.unsubscribe(port)
Unsubscribe to sensor notifications on a given port.
Kind: instance method of BoostHub
Param | Type |
---|---|
port | string |
"button" (button, state)
Emits when a button is pressed.
Kind: event emitted by BoostHub
Param | Type | Description |
---|---|---|
button | string |
|
state | number |
A number representing one of the button state consts. |
"distance" (port, distance)
Emits when a distance sensor is activated.
Kind: event emitted by BoostHub
Param | Type | Description |
---|---|---|
port | string |
|
distance | number |
Distance, in millimeters. |
"color" (port, color)
Emits when a color sensor is activated.
Kind: event emitted by BoostHub
Param | Type | Description |
---|---|---|
port | string |
|
color | number |
A number representing one of the LED color consts. |
"tilt" (port, x, y)
Emits when a tilt sensor is activated.
Kind: event emitted by BoostHub
Param | Type | Description |
---|---|---|
port | string |
If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. |
x | number |
|
y | number |
"rotate" (port, rotation)
Emits when a rotation sensor is activated.
Kind: event emitted by BoostHub
Param | Type |
---|---|
port | string |
rotation | number |
WeDo2Hub ⇐ Hub
Kind: global class
Extends: Hub
- WeDo2Hub ⇐
Hub
- .setLEDColor(color) ⇒
Promise
- .setLEDRGB(red, green, blue) ⇒
Promise
- .setMotorSpeed(port, speed) ⇒
Promise
- .connect() ⇒
Promise
- .disconnect()
- .subscribe(port, [mode])
- .unsubscribe(port)
- "button" (button, state)
- "distance" (port, distance)
- "color" (port, color)
- "tilt" (port, x, y)
- "rotate" (port, rotation)
- .setLEDColor(color) ⇒
weDo2Hub.setLEDColor(color) ⇒ Promise
Set the color of the LED on the Hub via a color value.
Kind: instance method of WeDo2Hub
Returns: Promise
- Resolved upon successful completion of command.
Param | Type | Description |
---|---|---|
color | number |
A number representing one of the LED color consts. |
weDo2Hub.setLEDRGB(red, green, blue) ⇒ Promise
Set the color of the LED on the Hub via RGB values.
Kind: instance method of WeDo2Hub
Returns: Promise
- Resolved upon successful completion of command.
Param | Type |
---|---|
red | number |
green | number |
blue | number |
weDo2Hub.setMotorSpeed(port, speed) ⇒ Promise
Set the motor speed on a given port.
Kind: instance method of WeDo2Hub
Returns: Promise
- Resolved upon successful completion of command.
Param | Type | Description |
---|---|---|
port | string |
|
speed | number |
For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
weDo2Hub.connect() ⇒ Promise
Connect to the Hub.
Kind: instance method of WeDo2Hub
Overrides: connect
Returns: Promise
- Resolved when successfully connected.
weDo2Hub.disconnect()
Disconnect the Hub.
Kind: instance method of WeDo2Hub
weDo2Hub.subscribe(port, [mode])
Subscribe to sensor notifications on a given port.
Kind: instance method of WeDo2Hub
Param | Type | Default | Description |
---|---|---|---|
port | string |
||
[mode] | number | boolean |
false |
The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
weDo2Hub.unsubscribe(port)
Unsubscribe to sensor notifications on a given port.
Kind: instance method of WeDo2Hub
Param | Type |
---|---|
port | string |
"button" (button, state)
Emits when a button is pressed.
Kind: event emitted by WeDo2Hub
Param | Type | Description |
---|---|---|
button | string |
|
state | number |
A number representing one of the button state consts. |
"distance" (port, distance)
Emits when a distance sensor is activated.
Kind: event emitted by WeDo2Hub
Param | Type | Description |
---|---|---|
port | string |
|
distance | number |
Distance, in millimeters. |
"color" (port, color)
Emits when a color sensor is activated.
Kind: event emitted by WeDo2Hub
Param | Type | Description |
---|---|---|
port | string |
|
color | number |
A number representing one of the LED color consts. |
"tilt" (port, x, y)
Emits when a tilt sensor is activated.
Kind: event emitted by WeDo2Hub
Param | Type |
---|---|
port | string |
x | number |
y | number |
"rotate" (port, rotation)
Emits when a rotation sensor is activated.
Kind: event emitted by WeDo2Hub
Param | Type |
---|---|
port | string |
rotation | number |
Hub ⇐ EventEmitter
Kind: global class
Extends: EventEmitter
- Hub ⇐
EventEmitter
hub.connect() ⇒ Promise
Connect to the Hub.
Kind: instance method of Hub
Returns: Promise
- Resolved when successfully connected.
hub.disconnect()
Disconnect the Hub.
Kind: instance method of Hub
hub.subscribe(port, [mode])
Subscribe to sensor notifications on a given port.
Kind: instance method of Hub
Param | Type | Default | Description |
---|---|---|---|
port | string |
||
[mode] | number | boolean |
false |
The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. |
hub.unsubscribe(port)
Unsubscribe to sensor notifications on a given port.
Kind: instance method of Hub
Param | Type |
---|---|
port | string |