Fixed bug when setting led on wedo hub

This commit is contained in:
Nathan Kunicki 2018-06-28 22:02:17 +01:00
parent 15fff746da
commit 184df80120
2 changed files with 2 additions and 4 deletions

View File

@ -64,8 +64,6 @@ export class LPF2 extends EventEmitter {
return;
}
console.log(peripheral);
peripheral.removeAllListeners();
noble.stopScanning();
noble.startScanning();

View File

@ -59,12 +59,12 @@ export class WeDo2Hub extends Hub {
public setLEDColor (color: number | boolean) {
return new Promise((resolve, reject) => {
let data = Buffer.from([0x06, 0x17, 0x01, 0x01]);
this._writeMessage(Consts.BLECharacteristics.WEDO2_MOTOR_VALUE_WRITE, data);
this._writeMessage(Consts.BLECharacteristics.WEDO2_PORT_TYPE_WRITE, data);
if (color === false) {
color = 0;
}
data = Buffer.from([0x06, 0x04, 0x01, color]);
this._writeMessage(Consts.BLECharacteristics.WEDO2_PORT_TYPE_WRITE, data);
this._writeMessage(Consts.BLECharacteristics.WEDO2_MOTOR_VALUE_WRITE, data);
return resolve();
});
}