From 6a7c4899b445f6affca09e8ced55e1c80c29e395 Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Sun, 15 Dec 2019 14:07:43 -0800 Subject: [PATCH 1/2] Added more motor types --- examples/new_device_test.js | 54 +++++++++++++++++++++++++++++---- src/MoveHubMediumLinearMotor.ts | 12 ++++++++ src/consts.ts | 12 ++++---- src/controlpluslargemotor.ts | 1 - src/controlplusxlargemotor.ts | 12 ++++++++ src/index-browser.ts | 14 ++++++++- src/index-node.ts | 14 ++++++++- src/lpf2hub.ts | 20 ++++++++++++ src/mediumlinearmotor.ts | 12 ++++++++ src/tachomotor.ts | 2 +- src/wedo2smarthub.ts | 19 +++++++++--- 11 files changed, 152 insertions(+), 20 deletions(-) create mode 100644 src/MoveHubMediumLinearMotor.ts create mode 100644 src/controlplusxlargemotor.ts create mode 100644 src/mediumlinearmotor.ts diff --git a/examples/new_device_test.js b/examples/new_device_test.js index 91a36ec..99f35e6 100644 --- a/examples/new_device_test.js +++ b/examples/new_device_test.js @@ -24,18 +24,60 @@ poweredUP.on("discover", async (hub) => { // Wait to discover hubs console.log(`Detached device ${device.type} from ${device.port}`); }); - if (device instanceof PoweredUP.ControlPlusLargeMotor) { + if ( + // device instanceof PoweredUP.MoveHubMediumLinearMotor || + device instanceof PoweredUP.MediumLinearMotor || + device instanceof PoweredUP.ControlPlusLargeMotor || + device instanceof PoweredUP.ControlPlusXLargeMotor + ) { const motor = device; motor.on("rotate", (angle) => { console.log(`Rotate ${angle}`); }); - await motor.rotateByAngle(9000, 50); - await motor.rotateByAngle(9000, -50); - await motor.rotateByAngle(9000, 50); - await motor.rotateByAngle(9000, -50); - motor.power(100); + await motor.rotateByAngle(900, 50); + await motor.rotateByAngle(900, -50); + await motor.rotateByAngle(900, 50); + await motor.rotateByAngle(900, -50); + motor.setPower(20); + } + + if ( + device instanceof PoweredUP.SimpleMediumLinearMotor || + device instanceof PoweredUP.TrainMotor + ) { + const motor = device; + + motor.setPower(20); + await hub.sleep(1000); + motor.setPower(40); + await hub.sleep(1000); + motor.setPower(60); + await hub.sleep(1000); + motor.setPower(80); + await hub.sleep(1000); + motor.setPower(100); + await hub.sleep(1000); + motor.setPower(60); + await hub.sleep(1000); + motor.setPower(20); + } + + if ( + device instanceof PoweredUP.Lights + ) { + const lights = device; + + lights.setBrightness(100); + await hub.sleep(1000); + lights.setBrightness(0); + await hub.sleep(1000); + lights.setBrightness(100); + await hub.sleep(1000); + lights.setBrightness(0); + await hub.sleep(1000); + lights.setBrightness(100); } if (device instanceof PoweredUP.ColorDistanceSensor) { diff --git a/src/MoveHubMediumLinearMotor.ts b/src/MoveHubMediumLinearMotor.ts new file mode 100644 index 0000000..ffb07a7 --- /dev/null +++ b/src/MoveHubMediumLinearMotor.ts @@ -0,0 +1,12 @@ +import { Hub } from "./hub"; + +import * as Consts from "./consts"; +import { TachoMotor } from "./tachomotor"; + +export class MoveHubMediumLinearMotor extends TachoMotor { + + constructor (hub: Hub, portId: number) { + super(hub, portId, Consts.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR); + } + +} diff --git a/src/consts.ts b/src/consts.ts index abb7960..2189508 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -26,7 +26,7 @@ export const HubTypeNames = HubType; /** * @typedef DeviceType * @property {number} UNKNOWN 0 - * @property {number} BASIC_MOTOR 1 + * @property {number} SIMPLE_MEDIUM_LINEAR_MOTOR 1 * @property {number} TRAIN_MOTOR 2 * @property {number} LED_LIGHTS 8 * @property {number} VOLTAGE 20 @@ -35,9 +35,9 @@ export const HubTypeNames = HubType; * @property {number} RGB_LIGHT 23 * @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} COLOR_DISTANCE_SENSOR 37 + * @property {number} MEDIUM_LINEAR_MOTOR 38 + * @property {number} MOVE_HUB_MEDIUM_LINEAR_MOTOR 39 * @property {number} BOOST_TILT 40 * @property {number} DUPLO_TRAIN_BASE_MOTOR 41 * @property {number} DUPLO_TRAIN_BASE_SPEAKER 42 @@ -62,8 +62,8 @@ export enum DeviceType { WEDO2_TILT = 34, WEDO2_DISTANCE = 35, COLOR_DISTANCE_SENSOR = 37, - BOOST_TACHO_MOTOR = 38, - BOOST_MOVE_HUB_MOTOR = 39, + MEDIUM_LINEAR_MOTOR = 38, + MOVE_HUB_MEDIUM_LINEAR_MOTOR = 39, BOOST_TILT = 40, DUPLO_TRAIN_BASE_MOTOR = 41, DUPLO_TRAIN_BASE_SPEAKER = 42, diff --git a/src/controlpluslargemotor.ts b/src/controlpluslargemotor.ts index 66077b7..8ba0567 100644 --- a/src/controlpluslargemotor.ts +++ b/src/controlpluslargemotor.ts @@ -1,4 +1,3 @@ -import { BasicMotor } from "./basicmotor"; import { Hub } from "./hub"; import * as Consts from "./consts"; diff --git a/src/controlplusxlargemotor.ts b/src/controlplusxlargemotor.ts new file mode 100644 index 0000000..c83bcde --- /dev/null +++ b/src/controlplusxlargemotor.ts @@ -0,0 +1,12 @@ +import { Hub } from "./hub"; + +import * as Consts from "./consts"; +import { TachoMotor } from "./tachomotor"; + +export class ControlPlusXLargeMotor extends TachoMotor { + + constructor (hub: Hub, portId: number) { + super(hub, portId, Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR); + } + +} diff --git a/src/index-browser.ts b/src/index-browser.ts index d1310d1..032e422 100644 --- a/src/index-browser.ts +++ b/src/index-browser.ts @@ -12,7 +12,13 @@ import { WeDo2SmartHub } from "./wedo2smarthub"; import { ColorDistanceSensor } from "./colordistancesensor"; import { ControlPlusLargeMotor } from "./controlpluslargemotor"; +import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; import { Device } from "./device"; +import { Lights } from "./lights"; +import { MediumLinearMotor } from "./mediumlinearmotor"; +import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TrainMotor } from "./trainmotor"; import { isWebBluetooth } from "./utils"; @@ -27,9 +33,15 @@ window.PoweredUP = { PUPRemote, DuploTrainBase, Consts, - Device, ColorDistanceSensor, ControlPlusLargeMotor, + ControlPlusXLargeMotor, + Device, + Lights, + MediumLinearMotor, + MoveHubMediumLinearMotor, + SimpleMediumLinearMotor, + TrainMotor, isWebBluetooth }; diff --git a/src/index-node.ts b/src/index-node.ts index 8805138..ccaed22 100644 --- a/src/index-node.ts +++ b/src/index-node.ts @@ -12,7 +12,13 @@ import { WeDo2SmartHub } from "./wedo2smarthub"; import { ColorDistanceSensor } from "./colordistancesensor"; import { ControlPlusLargeMotor } from "./controlpluslargemotor"; +import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; import { Device } from "./device"; +import { Lights } from "./lights"; +import { MediumLinearMotor } from "./mediumlinearmotor"; +import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TrainMotor } from "./trainmotor"; import { isWebBluetooth } from "./utils"; @@ -27,8 +33,14 @@ export { PUPRemote, DuploTrainBase, Consts, - Device, ColorDistanceSensor, ControlPlusLargeMotor, + ControlPlusXLargeMotor, + Device, + Lights, + MediumLinearMotor, + MoveHubMediumLinearMotor, + SimpleMediumLinearMotor, + TrainMotor, isWebBluetooth }; diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index 49a5532..f1d330a 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -3,7 +3,12 @@ import { Hub } from "./hub"; import { ColorDistanceSensor } from "./colordistancesensor"; import { ControlPlusLargeMotor } from "./controlpluslargemotor"; +import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; import { Lights } from "./lights"; +import { MediumLinearMotor } from "./mediumlinearmotor"; +import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TrainMotor } from "./trainmotor"; import * as Consts from "./consts"; @@ -287,9 +292,24 @@ export class LPF2Hub extends Hub { case Consts.DeviceType.LED_LIGHTS: device = new Lights(this, portId); break; + case Consts.DeviceType.TRAIN_MOTOR: + device = new TrainMotor(this, portId); + break; + case Consts.DeviceType.SIMPLE_MEDIUM_LINEAR_MOTOR: + device = new SimpleMediumLinearMotor(this, portId); + break; + case Consts.DeviceType.MOVE_HUB_MEDIUM_LINEAR_MOTOR: + device = new MoveHubMediumLinearMotor(this, portId); + break; + case Consts.DeviceType.MEDIUM_LINEAR_MOTOR: + device = new MediumLinearMotor(this, portId); + break; case Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR: device = new ControlPlusLargeMotor(this, portId); break; + case Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR: + device = new ControlPlusXLargeMotor(this, portId); + break; case Consts.DeviceType.COLOR_DISTANCE_SENSOR: device = new ColorDistanceSensor(this, portId); break; diff --git a/src/mediumlinearmotor.ts b/src/mediumlinearmotor.ts new file mode 100644 index 0000000..53680a6 --- /dev/null +++ b/src/mediumlinearmotor.ts @@ -0,0 +1,12 @@ +import { Hub } from "./hub"; + +import * as Consts from "./consts"; +import { TachoMotor } from "./tachomotor"; + +export class MediumLinearMotor extends TachoMotor { + + constructor (hub: Hub, portId: number) { + super(hub, portId, Consts.DeviceType.MEDIUM_LINEAR_MOTOR); + } + +} diff --git a/src/tachomotor.ts b/src/tachomotor.ts index f12fd89..3fee32e 100644 --- a/src/tachomotor.ts +++ b/src/tachomotor.ts @@ -38,7 +38,7 @@ export class TachoMotor extends BasicMotor { /** * Rotate a motor by a given angle. - * @method TachoMotor#setMotorAngle + * @method TachoMotor#rotateByAngle * @param {number} angle How much the motor should be rotated (in degrees). * @param {number} [power=100] For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. * @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished). diff --git a/src/wedo2smarthub.ts b/src/wedo2smarthub.ts index 7d53a1d..7eef844 100644 --- a/src/wedo2smarthub.ts +++ b/src/wedo2smarthub.ts @@ -7,7 +7,12 @@ import { Hub } from "./hub"; import { ColorDistanceSensor } from "./colordistancesensor"; import { ControlPlusLargeMotor } from "./controlpluslargemotor"; +import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; import { Lights } from "./lights"; +import { MediumLinearMotor } from "./mediumlinearmotor"; +import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TrainMotor } from "./trainmotor"; import * as Consts from "./consts"; @@ -279,16 +284,22 @@ export class WeDo2SmartHub extends Hub { case Consts.DeviceType.LED_LIGHTS: device = new Lights(this, portId); break; - case Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR: - device = new ControlPlusLargeMotor(this, portId); - break; + // case Consts.DeviceType.BOOST_TACHO_MOTOR: + // device = new BoostTachoMotor(this, portId); + // break; + // case Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR: + // device = new ControlPlusLargeMotor(this, portId); + // break; + // case Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR: + // device = new ControlPlusXLargeMotor(this, portId); + // break; case Consts.DeviceType.COLOR_DISTANCE_SENSOR: device = new ColorDistanceSensor(this, portId); break; default: device = new Device(this, portId, deviceType); break; - } + } this._attachDevice(device); From 198d637ef9d13cdb7b73ca8278f58aa57b97ffd4 Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Mon, 16 Dec 2019 08:42:40 -0800 Subject: [PATCH 2/2] Renamed devices --- examples/new_device_test.js | 4 ++-- src/consts.ts | 6 +++--- src/index-browser.ts | 14 ++++++------- src/index-node.ts | 14 ++++++------- src/{lights.ts => light.ts} | 4 ++-- src/lpf2hub.ts | 20 +++++++++---------- ...rgemotor.ts => techniclargelinearmotor.ts} | 4 ++-- ...gemotor.ts => technicxlargelinearmotor.ts} | 4 ++-- src/wedo2smarthub.ts | 12 +++++------ 9 files changed, 41 insertions(+), 41 deletions(-) rename src/{lights.ts => light.ts} (90%) rename src/{controlpluslargemotor.ts => techniclargelinearmotor.ts} (55%) rename src/{controlplusxlargemotor.ts => technicxlargelinearmotor.ts} (55%) diff --git a/examples/new_device_test.js b/examples/new_device_test.js index 99f35e6..fb05ed0 100644 --- a/examples/new_device_test.js +++ b/examples/new_device_test.js @@ -27,8 +27,8 @@ poweredUP.on("discover", async (hub) => { // Wait to discover hubs if ( // device instanceof PoweredUP.MoveHubMediumLinearMotor || device instanceof PoweredUP.MediumLinearMotor || - device instanceof PoweredUP.ControlPlusLargeMotor || - device instanceof PoweredUP.ControlPlusXLargeMotor + device instanceof PoweredUP.TechnicLargeLinearMotor || + device instanceof PoweredUP.TechnicXLargeLinearMotor ) { const motor = device; diff --git a/src/consts.ts b/src/consts.ts index 2189508..11f7bb7 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -54,7 +54,7 @@ export enum DeviceType { UNKNOWN = 0, SIMPLE_MEDIUM_LINEAR_MOTOR = 1, TRAIN_MOTOR = 2, - LED_LIGHTS = 8, + LIGHT = 8, VOLTAGE = 20, CURRENT = 21, PIEZO_TONE = 22, @@ -69,8 +69,8 @@ export enum DeviceType { DUPLO_TRAIN_BASE_SPEAKER = 42, DUPLO_TRAIN_BASE_COLOR = 43, DUPLO_TRAIN_BASE_SPEEDOMETER = 44, - CONTROL_PLUS_LARGE_MOTOR = 46, - CONTROL_PLUS_XLARGE_MOTOR = 47, + TECHNIC_LARGE_LINEAR_MOTOR = 46, + TECHNIC_XLARGE_LINEAR_MOTOR = 47, CONTROL_PLUS_GEST = 54, POWERED_UP_REMOTE_BUTTON = 55, RSSI = 56, diff --git a/src/index-browser.ts b/src/index-browser.ts index 032e422..0eafb35 100644 --- a/src/index-browser.ts +++ b/src/index-browser.ts @@ -11,13 +11,13 @@ import { PUPRemote } from "./pupremote"; import { WeDo2SmartHub } from "./wedo2smarthub"; import { ColorDistanceSensor } from "./colordistancesensor"; -import { ControlPlusLargeMotor } from "./controlpluslargemotor"; -import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; import { Device } from "./device"; -import { Lights } from "./lights"; +import { Light } from "./light"; import { MediumLinearMotor } from "./mediumlinearmotor"; -import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor"; import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TechnicLargeLinearMotor } from "./techniclargelinearmotor"; +import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor"; import { TrainMotor } from "./trainmotor"; import { isWebBluetooth } from "./utils"; @@ -34,13 +34,13 @@ window.PoweredUP = { DuploTrainBase, Consts, ColorDistanceSensor, - ControlPlusLargeMotor, - ControlPlusXLargeMotor, Device, - Lights, + Light, MediumLinearMotor, MoveHubMediumLinearMotor, SimpleMediumLinearMotor, + TechnicLargeLinearMotor, + TechnicXLargeLinearMotor, TrainMotor, isWebBluetooth }; diff --git a/src/index-node.ts b/src/index-node.ts index ccaed22..ffe988d 100644 --- a/src/index-node.ts +++ b/src/index-node.ts @@ -11,13 +11,13 @@ import { PUPRemote } from "./pupremote"; import { WeDo2SmartHub } from "./wedo2smarthub"; import { ColorDistanceSensor } from "./colordistancesensor"; -import { ControlPlusLargeMotor } from "./controlpluslargemotor"; -import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; import { Device } from "./device"; -import { Lights } from "./lights"; +import { Light } from "./light"; import { MediumLinearMotor } from "./mediumlinearmotor"; -import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor"; import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TechnicLargeLinearMotor } from "./techniclargelinearmotor"; +import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor"; import { TrainMotor } from "./trainmotor"; import { isWebBluetooth } from "./utils"; @@ -34,13 +34,13 @@ export { DuploTrainBase, Consts, ColorDistanceSensor, - ControlPlusLargeMotor, - ControlPlusXLargeMotor, Device, - Lights, + Light, MediumLinearMotor, MoveHubMediumLinearMotor, SimpleMediumLinearMotor, + TechnicLargeLinearMotor, + TechnicXLargeLinearMotor, TrainMotor, isWebBluetooth }; diff --git a/src/lights.ts b/src/light.ts similarity index 90% rename from src/lights.ts rename to src/light.ts index 8386d82..fda7104 100644 --- a/src/lights.ts +++ b/src/light.ts @@ -4,11 +4,11 @@ import { WeDo2SmartHub } from "./wedo2smarthub"; import * as Consts from "./consts"; -export class Lights extends Device { +export class Light extends Device { constructor (hub: Hub, portId: number) { - super(hub, portId, Consts.DeviceType.LED_LIGHTS); + super(hub, portId, Consts.DeviceType.LIGHT); } diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index f1d330a..b573bb3 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -2,12 +2,12 @@ import { Device } from "./device"; import { Hub } from "./hub"; import { ColorDistanceSensor } from "./colordistancesensor"; -import { ControlPlusLargeMotor } from "./controlpluslargemotor"; -import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; -import { Lights } from "./lights"; +import { Light } from "./light"; import { MediumLinearMotor } from "./mediumlinearmotor"; -import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor"; import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TechnicLargeLinearMotor } from "./techniclargelinearmotor"; +import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor"; import { TrainMotor } from "./trainmotor"; import * as Consts from "./consts"; @@ -289,8 +289,8 @@ export class LPF2Hub extends Hub { let device; switch (deviceType) { - case Consts.DeviceType.LED_LIGHTS: - device = new Lights(this, portId); + case Consts.DeviceType.LIGHT: + device = new Light(this, portId); break; case Consts.DeviceType.TRAIN_MOTOR: device = new TrainMotor(this, portId); @@ -304,11 +304,11 @@ export class LPF2Hub extends Hub { case Consts.DeviceType.MEDIUM_LINEAR_MOTOR: device = new MediumLinearMotor(this, portId); break; - case Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR: - device = new ControlPlusLargeMotor(this, portId); + case Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR: + device = new TechnicLargeLinearMotor(this, portId); break; - case Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR: - device = new ControlPlusXLargeMotor(this, portId); + case Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR: + device = new TechnicXLargeLinearMotor(this, portId); break; case Consts.DeviceType.COLOR_DISTANCE_SENSOR: device = new ColorDistanceSensor(this, portId); diff --git a/src/controlpluslargemotor.ts b/src/techniclargelinearmotor.ts similarity index 55% rename from src/controlpluslargemotor.ts rename to src/techniclargelinearmotor.ts index 8ba0567..5f65f08 100644 --- a/src/controlpluslargemotor.ts +++ b/src/techniclargelinearmotor.ts @@ -3,10 +3,10 @@ import { Hub } from "./hub"; import * as Consts from "./consts"; import { TachoMotor } from "./tachomotor"; -export class ControlPlusLargeMotor extends TachoMotor { +export class TechnicLargeLinearMotor extends TachoMotor { constructor (hub: Hub, portId: number) { - super(hub, portId, Consts.DeviceType.CONTROL_PLUS_LARGE_MOTOR); + super(hub, portId, Consts.DeviceType.TECHNIC_LARGE_LINEAR_MOTOR); } } diff --git a/src/controlplusxlargemotor.ts b/src/technicxlargelinearmotor.ts similarity index 55% rename from src/controlplusxlargemotor.ts rename to src/technicxlargelinearmotor.ts index c83bcde..4a24ccc 100644 --- a/src/controlplusxlargemotor.ts +++ b/src/technicxlargelinearmotor.ts @@ -3,10 +3,10 @@ import { Hub } from "./hub"; import * as Consts from "./consts"; import { TachoMotor } from "./tachomotor"; -export class ControlPlusXLargeMotor extends TachoMotor { +export class TechnicXLargeLinearMotor extends TachoMotor { constructor (hub: Hub, portId: number) { - super(hub, portId, Consts.DeviceType.CONTROL_PLUS_XLARGE_MOTOR); + super(hub, portId, Consts.DeviceType.TECHNIC_XLARGE_LINEAR_MOTOR); } } diff --git a/src/wedo2smarthub.ts b/src/wedo2smarthub.ts index 7eef844..dc81284 100644 --- a/src/wedo2smarthub.ts +++ b/src/wedo2smarthub.ts @@ -6,12 +6,12 @@ import { Device } from "./device"; import { Hub } from "./hub"; import { ColorDistanceSensor } from "./colordistancesensor"; -import { ControlPlusLargeMotor } from "./controlpluslargemotor"; -import { ControlPlusXLargeMotor } from "./controlplusxlargemotor"; -import { Lights } from "./lights"; +import { Light } from "./light"; import { MediumLinearMotor } from "./mediumlinearmotor"; -import { MoveHubMediumLinearMotor } from "./MoveHubMediumLinearMotor"; +import { MoveHubMediumLinearMotor } from "./movehubmediumlinearmotor"; import { SimpleMediumLinearMotor } from "./simplemediumlinearmotor"; +import { TechnicLargeLinearMotor } from "./techniclargelinearmotor"; +import { TechnicXLargeLinearMotor } from "./technicxlargelinearmotor"; import { TrainMotor } from "./trainmotor"; import * as Consts from "./consts"; @@ -281,8 +281,8 @@ export class WeDo2SmartHub extends Hub { let device; switch (deviceType) { - case Consts.DeviceType.LED_LIGHTS: - device = new Lights(this, portId); + case Consts.DeviceType.LIGHT: + device = new Light(this, portId); break; // case Consts.DeviceType.BOOST_TACHO_MOTOR: // device = new BoostTachoMotor(this, portId);