Merge pull request #85 from Microsoft/on_color_fix
Fix "on color detected" block
This commit is contained in:
commit
e7c697c24d
@ -106,9 +106,9 @@ namespace sensors {
|
|||||||
//% weight=100 blockGap=8
|
//% weight=100 blockGap=8
|
||||||
//% group="Color Sensor"
|
//% group="Color Sensor"
|
||||||
onColorDetected(color: ColorSensorColor, handler: () => void) {
|
onColorDetected(color: ColorSensorColor, handler: () => void) {
|
||||||
|
this.setMode(ColorSensorMode.Color)
|
||||||
const v = this._colorEventValue(<number>color);
|
const v = this._colorEventValue(<number>color);
|
||||||
control.onEvent(this._id, v, handler);
|
control.onEvent(this._id, v, handler);
|
||||||
this.setMode(ColorSensorMode.Color)
|
|
||||||
if (this.color() == color)
|
if (this.color() == color)
|
||||||
control.raiseEvent(this._id, v);
|
control.raiseEvent(this._id, v);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user