Color calibration (#245)

* better handling of thresholds, color calibration strategy

* updating calibration parameters
This commit is contained in:
Peli de Halleux
2018-01-19 13:11:11 -08:00
committed by GitHub
parent 23bb316403
commit bf6a932e5f
7 changed files with 145 additions and 89 deletions

View File

@ -2,21 +2,21 @@ enum UltrasonicSensorEvent {
//% block="object detected"
ObjectDetected = 10,
//% block="object near"
ObjectNear = sensors.internal.ThresholdState.Low,
ObjectNear = sensors.ThresholdState.Low,
//% block="object far"
ObjectFar = sensors.internal.ThresholdState.High
ObjectFar = sensors.ThresholdState.High
}
namespace sensors {
//% fixedInstances
export class UltraSonicSensor extends internal.UartSensor {
private promixityThreshold: sensors.internal.ThresholdDetector;
private promixityThreshold: sensors.ThresholdDetector;
private movementThreshold: number;
constructor(port: number) {
super(port)
this.promixityThreshold = new sensors.internal.ThresholdDetector(this.id(), 0, 255, 10, 100); // range is 0..255cm
this.promixityThreshold = new sensors.ThresholdDetector(this.id(), 0, 255, 10, 100); // range is 0..255cm
this.movementThreshold = 1;
}