Documentation for the consts
This commit is contained in:
parent
1150e012af
commit
7bdbfbdceb
129
DOCS.md
129
DOCS.md
@ -15,6 +15,19 @@
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
## Typedefs
|
||||
|
||||
<dl>
|
||||
<dt><a href="#Devices">Devices</a></dt>
|
||||
<dd></dd>
|
||||
<dt><a href="#Colors">Colors</a></dt>
|
||||
<dd></dd>
|
||||
<dt><a href="#ButtonStates">ButtonStates</a></dt>
|
||||
<dd></dd>
|
||||
<dt><a href="#DuploTrainBaseSounds">DuploTrainBaseSounds</a></dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
<a name="PoweredUP"></a>
|
||||
|
||||
## PoweredUP ⇐ <code>EventEmitter</code>
|
||||
@ -172,7 +185,7 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="WeDo2SmartHub+setLEDRGB"></a>
|
||||
|
||||
@ -322,7 +335,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="WeDo2SmartHub+event_distance"></a>
|
||||
|
||||
@ -346,7 +359,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="WeDo2SmartHub+event_tilt"></a>
|
||||
|
||||
@ -383,7 +396,7 @@ Emits when a motor or sensor is attached to the Hub.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||
| type | <code>number</code> | A number representing one of the <a href="#Devices">Devices</a>.. |
|
||||
|
||||
<a name="Hub+event_detach"></a>
|
||||
|
||||
@ -574,7 +587,7 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="LPF2Hub+setLEDRGB"></a>
|
||||
|
||||
@ -673,7 +686,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="LPF2Hub+event_distance"></a>
|
||||
|
||||
@ -697,7 +710,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -709,7 +722,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="LPF2Hub+event_tilt"></a>
|
||||
@ -748,7 +761,7 @@ Emits when a motor or sensor is attached to the Hub.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||
| type | <code>number</code> | A number representing one of the <a href="#Devices">Devices</a>.. |
|
||||
|
||||
<a name="Hub+event_detach"></a>
|
||||
|
||||
@ -924,7 +937,7 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="LPF2Hub+setLEDRGB"></a>
|
||||
|
||||
@ -1023,7 +1036,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="LPF2Hub+event_distance"></a>
|
||||
|
||||
@ -1047,7 +1060,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -1059,7 +1072,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="LPF2Hub+event_tilt"></a>
|
||||
@ -1086,7 +1099,7 @@ Emits when a motor or sensor is attached to the Hub.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||
| type | <code>number</code> | A number representing one of the <a href="#Devices">Devices</a>.. |
|
||||
|
||||
<a name="Hub+event_detach"></a>
|
||||
|
||||
@ -1200,7 +1213,7 @@ Set the color of the LED on the Remote via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="PUPRemote+setLEDRGB"></a>
|
||||
|
||||
@ -1312,7 +1325,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -1324,7 +1337,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="DuploTrainBase"></a>
|
||||
@ -1431,7 +1444,7 @@ Set the color of the LED on the train via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="DuploTrainBase+setMotorSpeed"></a>
|
||||
|
||||
@ -1457,7 +1470,7 @@ Play a built-in train sound.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| sound | <code>number</code> | A number representing one of the Train Base sound consts. |
|
||||
| sound | <code>number</code> | A number representing one of the <a href="#DuploTrainBaseSounds">DuploTrainBaseSounds</a>. |
|
||||
|
||||
<a name="DuploTrainBase+rampMotorSpeed"></a>
|
||||
|
||||
@ -1583,7 +1596,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -1595,7 +1608,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="LPF2Hub+event_speed"></a>
|
||||
@ -1610,3 +1623,77 @@ Emits on a speed change.
|
||||
| port | <code>string</code> |
|
||||
| speed | <code>number</code> |
|
||||
|
||||
<a name="Devices"></a>
|
||||
|
||||
## Devices
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| UNKNOWN | <code>number</code> | 0 |
|
||||
| BASIC_MOTOR | <code>number</code> | 1 |
|
||||
| TRAIN_MOTOR | <code>number</code> | 2 |
|
||||
| LED_LIGHTS | <code>number</code> | 8 |
|
||||
| BOOST_LED | <code>number</code> | 22 |
|
||||
| WEDO2_TILT | <code>number</code> | 34 |
|
||||
| WEDO2_DISTANCE | <code>number</code> | 35 |
|
||||
| BOOST_DISTANCE | <code>number</code> | 37 |
|
||||
| BOOST_TACHO_MOTOR | <code>number</code> | 38 |
|
||||
| BOOST_MOVE_HUB_MOTOR | <code>number</code> | 39 |
|
||||
| BOOST_TILT | <code>number</code> | 40 |
|
||||
| DUPLO_TRAIN_BASE_MOTOR | <code>number</code> | 41 |
|
||||
| DUPLO_TRAIN_BASE_SPEAKER | <code>number</code> | 42 |
|
||||
| DUPLO_TRAIN_BASE_COLOR | <code>number</code> | 43 |
|
||||
| DUPLO_TRAIN_BASE_SPEEDOMETER | <code>number</code> | 44 |
|
||||
| POWERED_UP_REMOTE_BUTTON | <code>number</code> | 55 |
|
||||
|
||||
<a name="Colors"></a>
|
||||
|
||||
## Colors
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| BLACK | <code>number</code> | 0 |
|
||||
| PINK | <code>number</code> | 1 |
|
||||
| PURPLE | <code>number</code> | 2 |
|
||||
| BLUE | <code>number</code> | 3 |
|
||||
| LIGHT_BLUE | <code>number</code> | 4 |
|
||||
| CYAN | <code>number</code> | 5 |
|
||||
| GREEN | <code>number</code> | 6 |
|
||||
| YELLOW | <code>number</code> | 7 |
|
||||
| ORANGE | <code>number</code> | 8 |
|
||||
| RED | <code>number</code> | 9 |
|
||||
| WHITE | <code>number</code> | 10 |
|
||||
| NONE | <code>number</code> | 255 |
|
||||
|
||||
<a name="ButtonStates"></a>
|
||||
|
||||
## ButtonStates
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| PRESSED | <code>number</code> | 0 |
|
||||
| RELEASED | <code>number</code> | 1 |
|
||||
| UP | <code>number</code> | 2 |
|
||||
| DOWN | <code>number</code> | 3 |
|
||||
| STOP | <code>number</code> | 4 |
|
||||
|
||||
<a name="DuploTrainBaseSounds"></a>
|
||||
|
||||
## DuploTrainBaseSounds
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| BREAK | <code>number</code> | 3 |
|
||||
| STATION_DEPARTURE | <code>number</code> | 5 |
|
||||
| WATER_REFILL | <code>number</code> | 7 |
|
||||
| HORN | <code>number</code> | 9 |
|
||||
| STEAM | <code>number</code> | 10 |
|
||||
|
||||
|
129
README.md
129
README.md
@ -98,6 +98,19 @@ Thanks go to Jorge Pereira ([@JorgePe](https://github.com/JorgePe)), Sebastian R
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
## Typedefs
|
||||
|
||||
<dl>
|
||||
<dt><a href="#Devices">Devices</a></dt>
|
||||
<dd></dd>
|
||||
<dt><a href="#Colors">Colors</a></dt>
|
||||
<dd></dd>
|
||||
<dt><a href="#ButtonStates">ButtonStates</a></dt>
|
||||
<dd></dd>
|
||||
<dt><a href="#DuploTrainBaseSounds">DuploTrainBaseSounds</a></dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
<a name="PoweredUP"></a>
|
||||
|
||||
## PoweredUP ⇐ <code>EventEmitter</code>
|
||||
@ -255,7 +268,7 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="WeDo2SmartHub+setLEDRGB"></a>
|
||||
|
||||
@ -405,7 +418,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="WeDo2SmartHub+event_distance"></a>
|
||||
|
||||
@ -429,7 +442,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="WeDo2SmartHub+event_tilt"></a>
|
||||
|
||||
@ -466,7 +479,7 @@ Emits when a motor or sensor is attached to the Hub.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||
| type | <code>number</code> | A number representing one of the <a href="#Devices">Devices</a>.. |
|
||||
|
||||
<a name="Hub+event_detach"></a>
|
||||
|
||||
@ -657,7 +670,7 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="LPF2Hub+setLEDRGB"></a>
|
||||
|
||||
@ -756,7 +769,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="LPF2Hub+event_distance"></a>
|
||||
|
||||
@ -780,7 +793,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -792,7 +805,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="LPF2Hub+event_tilt"></a>
|
||||
@ -831,7 +844,7 @@ Emits when a motor or sensor is attached to the Hub.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||
| type | <code>number</code> | A number representing one of the <a href="#Devices">Devices</a>.. |
|
||||
|
||||
<a name="Hub+event_detach"></a>
|
||||
|
||||
@ -1007,7 +1020,7 @@ Set the color of the LED on the Hub via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="LPF2Hub+setLEDRGB"></a>
|
||||
|
||||
@ -1106,7 +1119,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="LPF2Hub+event_distance"></a>
|
||||
|
||||
@ -1130,7 +1143,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -1142,7 +1155,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="LPF2Hub+event_tilt"></a>
|
||||
@ -1169,7 +1182,7 @@ Emits when a motor or sensor is attached to the Hub.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| type | <code>number</code> | A number representing one of the peripheral consts. |
|
||||
| type | <code>number</code> | A number representing one of the <a href="#Devices">Devices</a>.. |
|
||||
|
||||
<a name="Hub+event_detach"></a>
|
||||
|
||||
@ -1283,7 +1296,7 @@ Set the color of the LED on the Remote via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="PUPRemote+setLEDRGB"></a>
|
||||
|
||||
@ -1395,7 +1408,7 @@ Emits when a button is pressed.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| button | <code>string</code> | |
|
||||
| state | <code>number</code> | A number representing one of the button state consts. |
|
||||
| state | <code>number</code> | A number representing one of the <a href="#ButtonStates">ButtonStates</a>. |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -1407,7 +1420,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="DuploTrainBase"></a>
|
||||
@ -1514,7 +1527,7 @@ Set the color of the LED on the train via a color value.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a>. |
|
||||
|
||||
<a name="DuploTrainBase+setMotorSpeed"></a>
|
||||
|
||||
@ -1540,7 +1553,7 @@ Play a built-in train sound.
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| sound | <code>number</code> | A number representing one of the Train Base sound consts. |
|
||||
| sound | <code>number</code> | A number representing one of the <a href="#DuploTrainBaseSounds">DuploTrainBaseSounds</a>. |
|
||||
|
||||
<a name="DuploTrainBase+rampMotorSpeed"></a>
|
||||
|
||||
@ -1666,7 +1679,7 @@ Emits when a color sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
|
||||
<a name="LPF2Hub+event_colorAndDistance"></a>
|
||||
|
||||
@ -1678,7 +1691,7 @@ A combined color and distance event, emits when the sensor is activated.
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| port | <code>string</code> | |
|
||||
| color | <code>number</code> | A number representing one of the LED color consts. |
|
||||
| color | <code>number</code> | A number representing one of the LED <a href="#Colors">Colors</a> |
|
||||
| distance | <code>number</code> | Distance, in millimeters. |
|
||||
|
||||
<a name="LPF2Hub+event_speed"></a>
|
||||
@ -1693,3 +1706,77 @@ Emits on a speed change.
|
||||
| port | <code>string</code> |
|
||||
| speed | <code>number</code> |
|
||||
|
||||
<a name="Devices"></a>
|
||||
|
||||
## Devices
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| UNKNOWN | <code>number</code> | 0 |
|
||||
| BASIC_MOTOR | <code>number</code> | 1 |
|
||||
| TRAIN_MOTOR | <code>number</code> | 2 |
|
||||
| LED_LIGHTS | <code>number</code> | 8 |
|
||||
| BOOST_LED | <code>number</code> | 22 |
|
||||
| WEDO2_TILT | <code>number</code> | 34 |
|
||||
| WEDO2_DISTANCE | <code>number</code> | 35 |
|
||||
| BOOST_DISTANCE | <code>number</code> | 37 |
|
||||
| BOOST_TACHO_MOTOR | <code>number</code> | 38 |
|
||||
| BOOST_MOVE_HUB_MOTOR | <code>number</code> | 39 |
|
||||
| BOOST_TILT | <code>number</code> | 40 |
|
||||
| DUPLO_TRAIN_BASE_MOTOR | <code>number</code> | 41 |
|
||||
| DUPLO_TRAIN_BASE_SPEAKER | <code>number</code> | 42 |
|
||||
| DUPLO_TRAIN_BASE_COLOR | <code>number</code> | 43 |
|
||||
| DUPLO_TRAIN_BASE_SPEEDOMETER | <code>number</code> | 44 |
|
||||
| POWERED_UP_REMOTE_BUTTON | <code>number</code> | 55 |
|
||||
|
||||
<a name="Colors"></a>
|
||||
|
||||
## Colors
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| BLACK | <code>number</code> | 0 |
|
||||
| PINK | <code>number</code> | 1 |
|
||||
| PURPLE | <code>number</code> | 2 |
|
||||
| BLUE | <code>number</code> | 3 |
|
||||
| LIGHT_BLUE | <code>number</code> | 4 |
|
||||
| CYAN | <code>number</code> | 5 |
|
||||
| GREEN | <code>number</code> | 6 |
|
||||
| YELLOW | <code>number</code> | 7 |
|
||||
| ORANGE | <code>number</code> | 8 |
|
||||
| RED | <code>number</code> | 9 |
|
||||
| WHITE | <code>number</code> | 10 |
|
||||
| NONE | <code>number</code> | 255 |
|
||||
|
||||
<a name="ButtonStates"></a>
|
||||
|
||||
## ButtonStates
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| PRESSED | <code>number</code> | 0 |
|
||||
| RELEASED | <code>number</code> | 1 |
|
||||
| UP | <code>number</code> | 2 |
|
||||
| DOWN | <code>number</code> | 3 |
|
||||
| STOP | <code>number</code> | 4 |
|
||||
|
||||
<a name="DuploTrainBaseSounds"></a>
|
||||
|
||||
## DuploTrainBaseSounds
|
||||
**Kind**: global typedef
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| BREAK | <code>number</code> | 3 |
|
||||
| STATION_DEPARTURE | <code>number</code> | 5 |
|
||||
| WATER_REFILL | <code>number</code> | 7 |
|
||||
| HORN | <code>number</code> | 9 |
|
||||
| STEAM | <code>number</code> | 10 |
|
||||
|
||||
|
50
consts.ts
50
consts.ts
@ -8,6 +8,25 @@ export enum Hubs {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @typedef Devices
|
||||
* @property {number} UNKNOWN 0
|
||||
* @property {number} BASIC_MOTOR 1
|
||||
* @property {number} TRAIN_MOTOR 2
|
||||
* @property {number} LED_LIGHTS 8
|
||||
* @property {number} BOOST_LED 22
|
||||
* @property {number} WEDO2_TILT 34
|
||||
* @property {number} WEDO2_DISTANCE 35
|
||||
* @property {number} BOOST_DISTANCE 37
|
||||
* @property {number} BOOST_TACHO_MOTOR 38
|
||||
* @property {number} BOOST_MOVE_HUB_MOTOR 39
|
||||
* @property {number} BOOST_TILT 40
|
||||
* @property {number} DUPLO_TRAIN_BASE_MOTOR 41
|
||||
* @property {number} DUPLO_TRAIN_BASE_SPEAKER 42
|
||||
* @property {number} DUPLO_TRAIN_BASE_COLOR 43
|
||||
* @property {number} DUPLO_TRAIN_BASE_SPEEDOMETER 44
|
||||
* @property {number} POWERED_UP_REMOTE_BUTTON 55
|
||||
*/
|
||||
export enum Devices {
|
||||
UNKNOWN = 0,
|
||||
BASIC_MOTOR = 1,
|
||||
@ -28,6 +47,21 @@ export enum Devices {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @typedef Colors
|
||||
* @property {number} BLACK 0
|
||||
* @property {number} PINK 1
|
||||
* @property {number} PURPLE 2
|
||||
* @property {number} BLUE 3
|
||||
* @property {number} LIGHT_BLUE 4
|
||||
* @property {number} CYAN 5
|
||||
* @property {number} GREEN 6
|
||||
* @property {number} YELLOW 7
|
||||
* @property {number} ORANGE 8
|
||||
* @property {number} RED 9
|
||||
* @property {number} WHITE 10
|
||||
* @property {number} NONE 255
|
||||
*/
|
||||
export enum Colors {
|
||||
BLACK = 0,
|
||||
PINK = 1,
|
||||
@ -44,6 +78,14 @@ export enum Colors {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @typedef ButtonStates
|
||||
* @property {number} PRESSED 0
|
||||
* @property {number} RELEASED 1
|
||||
* @property {number} UP 2
|
||||
* @property {number} DOWN 3
|
||||
* @property {number} STOP 4
|
||||
*/
|
||||
export enum ButtonStates {
|
||||
PRESSED = 0,
|
||||
RELEASED = 1,
|
||||
@ -53,6 +95,14 @@ export enum ButtonStates {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @typedef DuploTrainBaseSounds
|
||||
* @property {number} BREAK 3
|
||||
* @property {number} STATION_DEPARTURE 5
|
||||
* @property {number} WATER_REFILL 7
|
||||
* @property {number} HORN 9
|
||||
* @property {number} STEAM 10
|
||||
*/
|
||||
export enum DuploTrainBaseSounds {
|
||||
BREAK = 3,
|
||||
STATION_DEPARTURE = 5,
|
||||
|
@ -81,7 +81,7 @@ export class DuploTrainBase extends LPF2Hub {
|
||||
/**
|
||||
* Set the color of the LED on the train via a color value.
|
||||
* @method DuploTrainBase#setLEDColor
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>.
|
||||
* @returns {Promise} Resolved upon successful issuance of command.
|
||||
*/
|
||||
public setLEDColor (color: number | boolean) {
|
||||
@ -138,7 +138,7 @@ export class DuploTrainBase extends LPF2Hub {
|
||||
/**
|
||||
* Play a built-in train sound.
|
||||
* @method DuploTrainBase#playSound
|
||||
* @param {number} sound A number representing one of the Train Base sound consts.
|
||||
* @param {number} sound A number representing one of the <a href="#DuploTrainBaseSounds">DuploTrainBaseSounds</a>.
|
||||
* @returns {Promise} Resolved upon successful issuance of command.
|
||||
*/
|
||||
public playSound (sound: number) {
|
||||
|
2
hub.ts
2
hub.ts
@ -257,7 +257,7 @@ export class Hub extends EventEmitter {
|
||||
* Emits when a motor or sensor is attached to the Hub.
|
||||
* @event Hub#attach
|
||||
* @param {string} port
|
||||
* @param {number} type A number representing one of the peripheral consts.
|
||||
* @param {number} type A number representing one of the <a href="#Devices">Devices</a>..
|
||||
*/
|
||||
this.emit("attach", port.id, type);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ export class LPF2Hub extends Hub {
|
||||
/**
|
||||
* Set the color of the LED on the Hub via a color value.
|
||||
* @method LPF2Hub#setLEDColor
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>.
|
||||
* @returns {Promise} Resolved upon successful issuance of command.
|
||||
*/
|
||||
public setLEDColor (color: number | boolean) {
|
||||
@ -186,7 +186,7 @@ export class LPF2Hub extends Hub {
|
||||
* Emits when a button is pressed.
|
||||
* @event LPF2Hub#button
|
||||
* @param {string} button
|
||||
* @param {number} state A number representing one of the button state consts.
|
||||
* @param {number} state A number representing one of the <a href="#ButtonStates">ButtonStates</a>.
|
||||
*/
|
||||
this.emit("button", "GREEN", Consts.ButtonStates.PRESSED);
|
||||
return;
|
||||
@ -289,7 +289,7 @@ export class LPF2Hub extends Hub {
|
||||
* Emits when a color sensor is activated.
|
||||
* @event LPF2Hub#color
|
||||
* @param {string} port
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>
|
||||
*/
|
||||
if (data[4] <= 10) {
|
||||
this.emit("color", port.id, data[4]);
|
||||
@ -310,7 +310,7 @@ export class LPF2Hub extends Hub {
|
||||
* A combined color and distance event, emits when the sensor is activated.
|
||||
* @event LPF2Hub#colorAndDistance
|
||||
* @param {string} port
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>
|
||||
* @param {number} distance Distance, in millimeters.
|
||||
*/
|
||||
if (data[4] <= 10) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tslint -c tslint.json \"*.ts\" && tsc",
|
||||
"docs": "jsdoc2md dist/poweredup.js dist/lpf2hub.js dist/wedo2smarthub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/duplotrainbase.js dist/hub.js dist/consts.js > DOCS.md",
|
||||
"docs": "jsdoc2md dist/consts.js dist/poweredup.js dist/lpf2hub.js dist/wedo2smarthub.js dist/boostmovehub.js dist/puphub.js dist/pupremote.js dist/duplotrainbase.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": "npm run build"
|
||||
|
@ -85,7 +85,7 @@ export class PUPRemote extends LPF2Hub {
|
||||
/**
|
||||
* Set the color of the LED on the Remote via a color value.
|
||||
* @method PUPRemote#setLEDColor
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>.
|
||||
* @returns {Promise} Resolved upon successful issuance of command.
|
||||
*/
|
||||
public setLEDColor (color: number | boolean) {
|
||||
|
@ -87,7 +87,7 @@ export class WeDo2SmartHub extends Hub {
|
||||
/**
|
||||
* Set the color of the LED on the Hub via a color value.
|
||||
* @method WeDo2SmartHub#setLEDColor
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>.
|
||||
* @returns {Promise} Resolved upon successful issuance of command.
|
||||
*/
|
||||
public setLEDColor (color: number | boolean) {
|
||||
@ -276,7 +276,7 @@ export class WeDo2SmartHub extends Hub {
|
||||
* Emits when a button is pressed.
|
||||
* @event WeDo2SmartHub#button
|
||||
* @param {string} button
|
||||
* @param {number} state A number representing one of the button state consts.
|
||||
* @param {number} state A number representing one of the <a href="#ButtonStates">ButtonStates</a>.
|
||||
*/
|
||||
this.emit("button", "GREEN", Consts.ButtonStates.PRESSED);
|
||||
return;
|
||||
@ -315,7 +315,7 @@ export class WeDo2SmartHub extends Hub {
|
||||
* Emits when a color sensor is activated.
|
||||
* @event WeDo2SmartHub#color
|
||||
* @param {string} port
|
||||
* @param {number} color A number representing one of the LED color consts.
|
||||
* @param {number} color A number representing one of the LED <a href="#Colors">Colors</a>.
|
||||
*/
|
||||
this.emit("color", port.id, distance);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user