Fixed bug when setting led on wedo hub
This commit is contained in:
parent
15fff746da
commit
184df80120
2
lpf2.ts
2
lpf2.ts
@ -64,8 +64,6 @@ export class LPF2 extends EventEmitter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(peripheral);
|
|
||||||
|
|
||||||
peripheral.removeAllListeners();
|
peripheral.removeAllListeners();
|
||||||
noble.stopScanning();
|
noble.stopScanning();
|
||||||
noble.startScanning();
|
noble.startScanning();
|
||||||
|
@ -59,12 +59,12 @@ export class WeDo2Hub extends Hub {
|
|||||||
public setLEDColor (color: number | boolean) {
|
public setLEDColor (color: number | boolean) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let data = Buffer.from([0x06, 0x17, 0x01, 0x01]);
|
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) {
|
if (color === false) {
|
||||||
color = 0;
|
color = 0;
|
||||||
}
|
}
|
||||||
data = Buffer.from([0x06, 0x04, 0x01, color]);
|
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();
|
return resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user