More documentation

This commit is contained in:
Nathan Kunicki 2018-06-21 18:27:50 +01:00
parent bb393c88aa
commit 3a413953db
3 changed files with 49 additions and 32 deletions

40
DOCS.md
View File

@ -45,13 +45,13 @@ Emits when a LPF2 Hub device is found.
**Extends**: [<code>Hub</code>](#Hub)
* [BoostHub](#BoostHub) ⇐ [<code>Hub</code>](#Hub)
* [.setLEDColor(color)](#BoostHub+setLEDColor)
* [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed)
* [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle)
* [.setLEDColor(color)](#BoostHub+setLEDColor)<code>Promise</code>
* [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed)<code>Promise</code>
* [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle)<code>Promise</code>
* [.connect([callback])](#Hub+connect)
* [.subscribe(port, [mode])](#Hub+subscribe)
* [.unsubscribe(port)](#Hub+unsubscribe)
* ["button" (state)](#BoostHub+event_button)
* ["button" (button, state)](#BoostHub+event_button)
* ["distance" (port, distance)](#BoostHub+event_distance)
* ["color" (port, color)](#BoostHub+event_color)
* ["tilt" (port, x, y)](#BoostHub+event_tilt)
@ -59,10 +59,11 @@ Emits when a LPF2 Hub device is found.
<a name="BoostHub+setLEDColor"></a>
### boostHub.setLEDColor(color)
### boostHub.setLEDColor(color)<code>Promise</code>
Set the color of the LED on the Hub via a color value.
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type | Description |
| --- | --- | --- |
@ -70,10 +71,11 @@ Set the color of the LED on the Hub via a color value.
<a name="BoostHub+setMotorSpeed"></a>
### boostHub.setMotorSpeed(port, speed, [time])
### boostHub.setMotorSpeed(port, speed, [time])<code>Promise</code>
Set the motor speed on a given port.
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command. If time is specified, this is once the motor is finished.
| Param | Type | Description |
| --- | --- | --- |
@ -83,10 +85,11 @@ Set the motor speed on a given port.
<a name="BoostHub+setMotorAngle"></a>
### boostHub.setMotorAngle(port, angle, [speed])
### boostHub.setMotorAngle(port, angle, [speed])<code>Promise</code>
Rotate a motor by a given angle.
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command (ie. once the motor is finished).
| Param | Type | Default | Description |
| --- | --- | --- | --- |
@ -131,13 +134,14 @@ Unsubscribe to sensor notifications on a given port.
<a name="BoostHub+event_button"></a>
### "button" (state)
### "button" (button, state)
Emits when a button is pressed.
**Kind**: event emitted by [<code>BoostHub</code>](#BoostHub)
| Param | Type | Description |
| --- | --- | --- |
| button | <code>string</code> | |
| state | <code>number</code> | A number representing one of the button state consts. |
<a name="BoostHub+event_distance"></a>
@ -196,13 +200,13 @@ Emits when a rotation sensor is activated.
**Extends**: [<code>Hub</code>](#Hub)
* [WeDo2Hub](#WeDo2Hub) ⇐ [<code>Hub</code>](#Hub)
* [.setLEDColor(color)](#WeDo2Hub+setLEDColor)
* [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB)
* [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed)
* [.setLEDColor(color)](#WeDo2Hub+setLEDColor)<code>Promise</code>
* [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB)<code>Promise</code>
* [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed)<code>Promise</code>
* [.connect([callback])](#Hub+connect)
* [.subscribe(port, [mode])](#Hub+subscribe)
* [.unsubscribe(port)](#Hub+unsubscribe)
* ["button" (state)](#WeDo2Hub+event_button)
* ["button" (button, state)](#WeDo2Hub+event_button)
* ["distance" (port, distance)](#WeDo2Hub+event_distance)
* ["color" (port, color)](#WeDo2Hub+event_color)
* ["tilt" (port, x, y)](#WeDo2Hub+event_tilt)
@ -210,10 +214,11 @@ Emits when a rotation sensor is activated.
<a name="WeDo2Hub+setLEDColor"></a>
### weDo2Hub.setLEDColor(color)
### weDo2Hub.setLEDColor(color)<code>Promise</code>
Set the color of the LED on the Hub via a color value.
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type | Description |
| --- | --- | --- |
@ -221,10 +226,11 @@ Set the color of the LED on the Hub via a color value.
<a name="WeDo2Hub+setLEDRGB"></a>
### weDo2Hub.setLEDRGB(red, green, blue)
### weDo2Hub.setLEDRGB(red, green, blue)<code>Promise</code>
Set the color of the LED on the Hub via RGB values.
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type |
| --- | --- |
@ -234,10 +240,11 @@ Set the color of the LED on the Hub via RGB values.
<a name="WeDo2Hub+setMotorSpeed"></a>
### weDo2Hub.setMotorSpeed(port, speed)
### weDo2Hub.setMotorSpeed(port, speed)<code>Promise</code>
Set the motor speed on a given port.
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type | Description |
| --- | --- | --- |
@ -281,13 +288,14 @@ Unsubscribe to sensor notifications on a given port.
<a name="WeDo2Hub+event_button"></a>
### "button" (state)
### "button" (button, state)
Emits when a button is pressed.
**Kind**: event emitted by [<code>WeDo2Hub</code>](#WeDo2Hub)
| Param | Type | Description |
| --- | --- | --- |
| button | <code>string</code> | |
| state | <code>number</code> | A number representing one of the button state consts. |
<a name="WeDo2Hub+event_distance"></a>

View File

@ -85,13 +85,13 @@ Emits when a LPF2 Hub device is found.
**Extends**: [<code>Hub</code>](#Hub)
* [BoostHub](#BoostHub) ⇐ [<code>Hub</code>](#Hub)
* [.setLEDColor(color)](#BoostHub+setLEDColor)
* [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed)
* [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle)
* [.setLEDColor(color)](#BoostHub+setLEDColor)<code>Promise</code>
* [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed)<code>Promise</code>
* [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle)<code>Promise</code>
* [.connect([callback])](#Hub+connect)
* [.subscribe(port, [mode])](#Hub+subscribe)
* [.unsubscribe(port)](#Hub+unsubscribe)
* ["button" (state)](#BoostHub+event_button)
* ["button" (button, state)](#BoostHub+event_button)
* ["distance" (port, distance)](#BoostHub+event_distance)
* ["color" (port, color)](#BoostHub+event_color)
* ["tilt" (port, x, y)](#BoostHub+event_tilt)
@ -99,10 +99,11 @@ Emits when a LPF2 Hub device is found.
<a name="BoostHub+setLEDColor"></a>
### boostHub.setLEDColor(color)
### boostHub.setLEDColor(color)<code>Promise</code>
Set the color of the LED on the Hub via a color value.
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type | Description |
| --- | --- | --- |
@ -110,10 +111,11 @@ Set the color of the LED on the Hub via a color value.
<a name="BoostHub+setMotorSpeed"></a>
### boostHub.setMotorSpeed(port, speed, [time])
### boostHub.setMotorSpeed(port, speed, [time])<code>Promise</code>
Set the motor speed on a given port.
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command. If time is specified, this is once the motor is finished.
| Param | Type | Description |
| --- | --- | --- |
@ -123,10 +125,11 @@ Set the motor speed on a given port.
<a name="BoostHub+setMotorAngle"></a>
### boostHub.setMotorAngle(port, angle, [speed])
### boostHub.setMotorAngle(port, angle, [speed])<code>Promise</code>
Rotate a motor by a given angle.
**Kind**: instance method of [<code>BoostHub</code>](#BoostHub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command (ie. once the motor is finished).
| Param | Type | Default | Description |
| --- | --- | --- | --- |
@ -171,13 +174,14 @@ Unsubscribe to sensor notifications on a given port.
<a name="BoostHub+event_button"></a>
### "button" (state)
### "button" (button, state)
Emits when a button is pressed.
**Kind**: event emitted by [<code>BoostHub</code>](#BoostHub)
| Param | Type | Description |
| --- | --- | --- |
| button | <code>string</code> | |
| state | <code>number</code> | A number representing one of the button state consts. |
<a name="BoostHub+event_distance"></a>
@ -236,13 +240,13 @@ Emits when a rotation sensor is activated.
**Extends**: [<code>Hub</code>](#Hub)
* [WeDo2Hub](#WeDo2Hub) ⇐ [<code>Hub</code>](#Hub)
* [.setLEDColor(color)](#WeDo2Hub+setLEDColor)
* [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB)
* [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed)
* [.setLEDColor(color)](#WeDo2Hub+setLEDColor)<code>Promise</code>
* [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB)<code>Promise</code>
* [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed)<code>Promise</code>
* [.connect([callback])](#Hub+connect)
* [.subscribe(port, [mode])](#Hub+subscribe)
* [.unsubscribe(port)](#Hub+unsubscribe)
* ["button" (state)](#WeDo2Hub+event_button)
* ["button" (button, state)](#WeDo2Hub+event_button)
* ["distance" (port, distance)](#WeDo2Hub+event_distance)
* ["color" (port, color)](#WeDo2Hub+event_color)
* ["tilt" (port, x, y)](#WeDo2Hub+event_tilt)
@ -250,10 +254,11 @@ Emits when a rotation sensor is activated.
<a name="WeDo2Hub+setLEDColor"></a>
### weDo2Hub.setLEDColor(color)
### weDo2Hub.setLEDColor(color)<code>Promise</code>
Set the color of the LED on the Hub via a color value.
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type | Description |
| --- | --- | --- |
@ -261,10 +266,11 @@ Set the color of the LED on the Hub via a color value.
<a name="WeDo2Hub+setLEDRGB"></a>
### weDo2Hub.setLEDRGB(red, green, blue)
### weDo2Hub.setLEDRGB(red, green, blue)<code>Promise</code>
Set the color of the LED on the Hub via RGB values.
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type |
| --- | --- |
@ -274,10 +280,11 @@ Set the color of the LED on the Hub via RGB values.
<a name="WeDo2Hub+setMotorSpeed"></a>
### weDo2Hub.setMotorSpeed(port, speed)
### weDo2Hub.setMotorSpeed(port, speed)<code>Promise</code>
Set the motor speed on a given port.
**Kind**: instance method of [<code>WeDo2Hub</code>](#WeDo2Hub)
**Returns**: <code>Promise</code> - Resolved upon successful completion of command.
| Param | Type | Description |
| --- | --- | --- |
@ -321,13 +328,14 @@ Unsubscribe to sensor notifications on a given port.
<a name="WeDo2Hub+event_button"></a>
### "button" (state)
### "button" (button, state)
Emits when a button is pressed.
**Kind**: event emitted by [<code>WeDo2Hub</code>](#WeDo2Hub)
| Param | Type | Description |
| --- | --- | --- |
| button | <code>string</code> | |
| state | <code>number</code> | A number representing one of the button state consts. |
<a name="WeDo2Hub+event_distance"></a>

View File

@ -8,6 +8,7 @@
"build": "tslint -c tslint.json \"*.ts\" && tsc",
"docs": "jsdoc2md dist/lpf2.js dist/boosthub.js dist/wedo2hub.js dist/hub.js dist/consts.js > DOCS.md",
"readme": "cat ABOUT.md DOCS.md > README.md",
"all": "npm run build && npm run docs && npm run readme",
"prepublishOnly": "tsc"
},
"author": "Nathan Kunicki <me@nathankunicki.com>",