diff --git a/README.md b/README.md new file mode 100644 index 0000000..b91357f --- /dev/null +++ b/README.md @@ -0,0 +1,249 @@ +## Classes + +
+
LPF2EventEmitter
+
+
HubEventEmitter
+
+
WeDo2HubHub
+
+
BoostHubHub
+
+
+ + + +## LPF2 ⇐ EventEmitter +**Kind**: global class +**Extends**: EventEmitter + +* [LPF2](#LPF2) ⇐ EventEmitter + * [.scan()](#LPF2+scan) + * ["discover" (hub)](#LPF2+event_discover) + + + +### lpF2.scan() +Begin scanning for LPF2 Hub devices. + +**Kind**: instance method of [LPF2](#LPF2) + + +### "discover" (hub) +Emits when a LPF2 Hub device is found. + +**Kind**: event emitted by [LPF2](#LPF2) + +| Param | Type | +| --- | --- | +| hub | [Hub](#Hub) | + + + +## Hub ⇐ EventEmitter +**Kind**: global class +**Extends**: EventEmitter + +* [Hub](#Hub) ⇐ EventEmitter + * [.connect([callback])](#Hub+connect) + * [.subscribe(port, [mode])](#Hub+subscribe) + * [.subscribe(port)](#Hub+subscribe) + * [.connectCallback](#Hub+connectCallback) : function + + + +### hub.connect([callback]) +Connect to the Hub. + +**Kind**: instance method of [Hub](#Hub) + +| Param | Type | +| --- | --- | +| [callback] | [connectCallback](#Hub+connectCallback) | + + + +### hub.subscribe(port, [mode]) +Subscribe to sensor notifications on a given port. + +**Kind**: instance method of [Hub](#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.subscribe(port) +Unsubscribe to sensor notifications on a given port. + +**Kind**: instance method of [Hub](#Hub) + +| Param | Type | +| --- | --- | +| port | string | + + + +### hub.connectCallback : function +**Kind**: instance typedef of [Hub](#Hub) + + +## WeDo2Hub ⇐ [Hub](#Hub) +**Kind**: global class +**Extends**: [Hub](#Hub) + +* [WeDo2Hub](#WeDo2Hub) ⇐ [Hub](#Hub) + * [.setLEDColor(color)](#WeDo2Hub+setLEDColor) + * [.setLEDRGB(red, green, blue)](#WeDo2Hub+setLEDRGB) + * [.setMotorSpeed(port, speed)](#WeDo2Hub+setMotorSpeed) + * [.connect([callback])](#Hub+connect) + * [.subscribe(port, [mode])](#Hub+subscribe) + * [.connectCallback](#Hub+connectCallback) : function + + + +### weDo2Hub.setLEDColor(color) +Set the color of the LED on the Hub via a color value. + +**Kind**: instance method of [WeDo2Hub](#WeDo2Hub) + +| Param | Type | Description | +| --- | --- | --- | +| color | number | A number representing one of the LED color consts. | + + + +### weDo2Hub.setLEDRGB(red, green, blue) +Set the color of the LED on the Hub via RGB values. + +**Kind**: instance method of [WeDo2Hub](#WeDo2Hub) + +| Param | Type | +| --- | --- | +| red | number | +| green | number | +| blue | number | + + + +### weDo2Hub.setMotorSpeed(port, speed) +Set the motor speed on a given port. + +**Kind**: instance method of [WeDo2Hub](#WeDo2Hub) + +| 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([callback]) +Connect to the Hub. + +**Kind**: instance method of [WeDo2Hub](#WeDo2Hub) +**Overrides**: [connect](#Hub+connect) + +| Param | Type | +| --- | --- | +| [callback] | [connectCallback](#Hub+connectCallback) | + + + +### weDo2Hub.subscribe(port, [mode]) +Subscribe to sensor notifications on a given port. + +**Kind**: instance method of [WeDo2Hub](#WeDo2Hub) +**Overrides**: [subscribe](#Hub+subscribe) + +| 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.connectCallback : function +**Kind**: instance typedef of [WeDo2Hub](#WeDo2Hub) + + +## BoostHub ⇐ [Hub](#Hub) +**Kind**: global class +**Extends**: [Hub](#Hub) + +* [BoostHub](#BoostHub) ⇐ [Hub](#Hub) + * [.setLEDColor(color)](#BoostHub+setLEDColor) + * [.setMotorSpeed(port, speed, [time])](#BoostHub+setMotorSpeed) + * [.setMotorAngle(port, angle, [speed])](#BoostHub+setMotorAngle) + * [.connect([callback])](#Hub+connect) + * [.subscribe(port, [mode])](#Hub+subscribe) + * [.connectCallback](#Hub+connectCallback) : function + + + +### boostHub.setLEDColor(color) +Set the color of the LED on the Hub via a color value. + +**Kind**: instance method of [BoostHub](#BoostHub) + +| Param | Type | Description | +| --- | --- | --- | +| color | number | A number representing one of the LED color consts. | + + + +### boostHub.setMotorSpeed(port, speed, [time]) +Set the motor speed on a given port. + +**Kind**: instance method of [BoostHub](#BoostHub) + +| 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]) +Rotate a motor by a given angle. + +**Kind**: instance method of [BoostHub](#BoostHub) + +| 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([callback]) +Connect to the Hub. + +**Kind**: instance method of [BoostHub](#BoostHub) +**Overrides**: [connect](#Hub+connect) + +| Param | Type | +| --- | --- | +| [callback] | [connectCallback](#Hub+connectCallback) | + + + +### boostHub.subscribe(port, [mode]) +Subscribe to sensor notifications on a given port. + +**Kind**: instance method of [BoostHub](#BoostHub) +**Overrides**: [subscribe](#Hub+subscribe) + +| 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.connectCallback : function +**Kind**: instance typedef of [BoostHub](#BoostHub)