fixing threshold
This commit is contained in:
		@@ -19,7 +19,7 @@
 | 
				
			|||||||
  "sensors.ColorSensor.onLightChanged|block": "on %sensor|%mode|%condition",
 | 
					  "sensors.ColorSensor.onLightChanged|block": "on %sensor|%mode|%condition",
 | 
				
			||||||
  "sensors.ColorSensor.pauseForColor|block": "pause %sensor|for color %color",
 | 
					  "sensors.ColorSensor.pauseForColor|block": "pause %sensor|for color %color",
 | 
				
			||||||
  "sensors.ColorSensor.pauseForLight|block": "pause %sensor|for %mode|%condition",
 | 
					  "sensors.ColorSensor.pauseForLight|block": "pause %sensor|for %mode|%condition",
 | 
				
			||||||
  "sensors.ColorSensor.setThreshold|block": "set %condition|to %value",
 | 
					  "sensors.ColorSensor.setThreshold|block": "set %sensor|%condition|to %value",
 | 
				
			||||||
  "sensors.color1|block": "color 1",
 | 
					  "sensors.color1|block": "color 1",
 | 
				
			||||||
  "sensors.color2|block": "color 2",
 | 
					  "sensors.color2|block": "color 2",
 | 
				
			||||||
  "sensors.color3|block": "color 3",
 | 
					  "sensors.color3|block": "color 3",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -227,8 +227,9 @@ namespace sensors {
 | 
				
			|||||||
         * @param condition the dark or bright light condition
 | 
					         * @param condition the dark or bright light condition
 | 
				
			||||||
         * @param value the value threshold
 | 
					         * @param value the value threshold
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        //% blockId=colorSetThreshold block="set %condition|to %value"
 | 
					        //% blockId=colorSetThreshold block="set %sensor|%condition|to %value"
 | 
				
			||||||
        //% group="Threshold" blockGap=8 weight=90
 | 
					        //% group="Threshold" blockGap=8 weight=90
 | 
				
			||||||
 | 
					        //% value.min=0 value.max=100
 | 
				
			||||||
        setThreshold(condition: LightCondition, value: number) {
 | 
					        setThreshold(condition: LightCondition, value: number) {
 | 
				
			||||||
            if (condition == LightCondition.Dark)
 | 
					            if (condition == LightCondition.Dark)
 | 
				
			||||||
                this.thresholdDetector.setLowThreshold(value)
 | 
					                this.thresholdDetector.setLowThreshold(value)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
  "sensors.InfraredSensor.pauseUntil|block": "pause until %sensor| %event",
 | 
					  "sensors.InfraredSensor.pauseUntil|block": "pause until %sensor| %event",
 | 
				
			||||||
  "sensors.InfraredSensor.proximity|block": "%sensor|proximity",
 | 
					  "sensors.InfraredSensor.proximity|block": "%sensor|proximity",
 | 
				
			||||||
  "sensors.InfraredSensor.remoteCommand|block": "%sensor|remote command",
 | 
					  "sensors.InfraredSensor.remoteCommand|block": "%sensor|remote command",
 | 
				
			||||||
  "sensors.InfraredSensor.setThreshold|block": "set %condition|to %value",
 | 
					  "sensors.InfraredSensor.setThreshold|block": "set %sensor|%condition|to %value",
 | 
				
			||||||
  "sensors.RemoteInfraredBeaconButton.isPressed|block": "%button|is pressed",
 | 
					  "sensors.RemoteInfraredBeaconButton.isPressed|block": "%button|is pressed",
 | 
				
			||||||
  "sensors.RemoteInfraredBeaconButton.onEvent|block": "on %button|%event",
 | 
					  "sensors.RemoteInfraredBeaconButton.onEvent|block": "on %button|%event",
 | 
				
			||||||
  "sensors.RemoteInfraredBeaconButton.wasPressed|block": "%button|was pressed",
 | 
					  "sensors.RemoteInfraredBeaconButton.wasPressed|block": "%button|was pressed",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -257,8 +257,9 @@ namespace sensors {
 | 
				
			|||||||
         * @param condition the dark or bright light condition
 | 
					         * @param condition the dark or bright light condition
 | 
				
			||||||
         * @param value the value threshold
 | 
					         * @param value the value threshold
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        //% blockId=irSetThreshold block="set %condition|to %value"
 | 
					        //% blockId=irSetThreshold block="set %sensor|%condition|to %value"
 | 
				
			||||||
        //% group="Threshold" blockGap=8
 | 
					        //% group="Threshold" blockGap=8
 | 
				
			||||||
 | 
					        //% value.min=0 value.max=100
 | 
				
			||||||
        setThreshold(condition: InfraredSensorEvent, value: number) {
 | 
					        setThreshold(condition: InfraredSensorEvent, value: number) {
 | 
				
			||||||
            if (condition == InfraredSensorEvent.ObjectNear)
 | 
					            if (condition == InfraredSensorEvent.ObjectNear)
 | 
				
			||||||
                this.proximityThreshold.setLowThreshold(value)
 | 
					                this.proximityThreshold.setLowThreshold(value)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
  "sensors.UltraSonicSensor.distance|block": "%sensor|distance",
 | 
					  "sensors.UltraSonicSensor.distance|block": "%sensor|distance",
 | 
				
			||||||
  "sensors.UltraSonicSensor.onEvent|block": "on %sensor|%event",
 | 
					  "sensors.UltraSonicSensor.onEvent|block": "on %sensor|%event",
 | 
				
			||||||
  "sensors.UltraSonicSensor.pauseUntil|block": "pause until %sensor| %event",
 | 
					  "sensors.UltraSonicSensor.pauseUntil|block": "pause until %sensor| %event",
 | 
				
			||||||
  "sensors.UltraSonicSensor.setThreshold|block": "set %condition|to %value",
 | 
					  "sensors.UltraSonicSensor.setThreshold|block": "set %sensor|%condition|to %value",
 | 
				
			||||||
  "sensors.ultrasonic1|block": "ultrasonic 1",
 | 
					  "sensors.ultrasonic1|block": "ultrasonic 1",
 | 
				
			||||||
  "sensors.ultrasonic2|block": "ultrasonic 2",
 | 
					  "sensors.ultrasonic2|block": "ultrasonic 2",
 | 
				
			||||||
  "sensors.ultrasonic3|block": "ultrasonic 3",
 | 
					  "sensors.ultrasonic3|block": "ultrasonic 3",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,8 +92,9 @@ namespace sensors {
 | 
				
			|||||||
         * @param condition the dark or bright light condition
 | 
					         * @param condition the dark or bright light condition
 | 
				
			||||||
         * @param value the value threshold
 | 
					         * @param value the value threshold
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        //% blockId=ultrasonicSetThreshold block="set %condition|to %value"
 | 
					        //% blockId=ultrasonicSetThreshold block="set %sensor|%condition|to %value"
 | 
				
			||||||
        //% group="Threshold" blockGap=8
 | 
					        //% group="Threshold" blockGap=8
 | 
				
			||||||
 | 
					        //% value.min=0 value.max=255
 | 
				
			||||||
        setThreshold(condition: UltrasonicSensorEvent, value: number) {            
 | 
					        setThreshold(condition: UltrasonicSensorEvent, value: number) {            
 | 
				
			||||||
            switch(condition) {
 | 
					            switch(condition) {
 | 
				
			||||||
                case UltrasonicSensorEvent.ObjectNear: this.promixityThreshold.setLowThreshold(value); break;
 | 
					                case UltrasonicSensorEvent.ObjectNear: this.promixityThreshold.setLowThreshold(value); break;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user