more images
This commit is contained in:
		@@ -55,61 +55,61 @@
 | 
			
		||||
  "motors.Motor.speed|block": "%motor|speed",
 | 
			
		||||
  "motors.Motor.stop|block": "stop %motor",
 | 
			
		||||
  "motors.Motor.tachoCount|block": "%motor|tacho count",
 | 
			
		||||
  "motors.largeMotorA|block": "`icons.motorLarge` A",
 | 
			
		||||
  "motors.largeMotorB|block": "`icons.motorLarge` B",
 | 
			
		||||
  "motors.largeMotorC|block": "`icons.motorLarge` C",
 | 
			
		||||
  "motors.largeMotorD|block": "`icons.motorLarge` D",
 | 
			
		||||
  "motors.mediumMotorA|block": "`icons.motorMedium` A",
 | 
			
		||||
  "motors.mediumMotorB|block": "`icons.motorMedium` B",
 | 
			
		||||
  "motors.mediumMotorC|block": "`icons.motorMedium` C",
 | 
			
		||||
  "motors.mediumMotorD|block": "`icons.motorMedium` D",
 | 
			
		||||
  "motors.largeMotorA|block": "large A",
 | 
			
		||||
  "motors.largeMotorB|block": "large B",
 | 
			
		||||
  "motors.largeMotorC|block": "large C",
 | 
			
		||||
  "motors.largeMotorD|block": "large D",
 | 
			
		||||
  "motors.mediumMotorA|block": "medium A",
 | 
			
		||||
  "motors.mediumMotorB|block": "medium B",
 | 
			
		||||
  "motors.mediumMotorC|block": "medium C",
 | 
			
		||||
  "motors.mediumMotorD|block": "medium D",
 | 
			
		||||
  "motors.stopAllMotors|block": "stop all motors",
 | 
			
		||||
  "motors|block": "motors",
 | 
			
		||||
  "output|block": "output",
 | 
			
		||||
  "screen|block": "screen",
 | 
			
		||||
  "sensors.ColorSensor.ambientLight|block": "%color| ambient light",
 | 
			
		||||
  "sensors.ColorSensor.color|block": "%color| color",
 | 
			
		||||
  "sensors.ColorSensor.onColorDetected|block": "on %sensor|detected %color",
 | 
			
		||||
  "sensors.ColorSensor.reflectedLight|block": "%color| reflected light",
 | 
			
		||||
  "sensors.GyroSensor.angle|block": "%sensor|angle",
 | 
			
		||||
  "sensors.GyroSensor.rate|block": "%sensor|rotation rate",
 | 
			
		||||
  "sensors.InfraredSensor.on|block": "on %sensor|%event",
 | 
			
		||||
  "sensors.InfraredSensor.proximity|block": "%infrared|proximity",
 | 
			
		||||
  "sensors.InfraredSensor.remoteCommand|block": "%infrared|remote command",
 | 
			
		||||
  "sensors.InfraredSensor.wait|block": "wait %sensor|for %event",
 | 
			
		||||
  "sensors.ColorSensor.ambientLight|block": "`icons.colorSensor` %color| ambient light",
 | 
			
		||||
  "sensors.ColorSensor.color|block": "`icons.colorSensor` %color| color",
 | 
			
		||||
  "sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected %color",
 | 
			
		||||
  "sensors.ColorSensor.reflectedLight|block": "`icons.colorSensor` %color| reflected light",
 | 
			
		||||
  "sensors.GyroSensor.angle|block": "`icons.gyroSensor` %sensor|angle",
 | 
			
		||||
  "sensors.GyroSensor.rate|block": "`icons.gyroSensor` %sensor|rotation rate",
 | 
			
		||||
  "sensors.InfraredSensor.on|block": "on `icons.infraredSensor` %sensor|%event",
 | 
			
		||||
  "sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %infrared|proximity",
 | 
			
		||||
  "sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %infrared|remote command",
 | 
			
		||||
  "sensors.InfraredSensor.wait|block": "wait `icons.infraredSensor` %sensor|for %event",
 | 
			
		||||
  "sensors.RemoteInfraredBeaconButton.isPressed|block": "%button|is pressed",
 | 
			
		||||
  "sensors.RemoteInfraredBeaconButton.onEvent|block": "on %button|%event",
 | 
			
		||||
  "sensors.RemoteInfraredBeaconButton.wasPressed|block": "%button|was pressed",
 | 
			
		||||
  "sensors.TouchSensor.isTouched|block": "%sensor|is touched",
 | 
			
		||||
  "sensors.TouchSensor.onEvent|block": "on %sensor|%event",
 | 
			
		||||
  "sensors.UltraSonicSensor.distance|block": "%sensor|distance",
 | 
			
		||||
  "sensors.UltraSonicSensor.on|block": "on %sensor|%event",
 | 
			
		||||
  "sensors.UltraSonicSensor.wait|block": "wait %sensor|for %event",
 | 
			
		||||
  "sensors.color1|block": "color sensor 1",
 | 
			
		||||
  "sensors.color2|block": "color sensor 2",
 | 
			
		||||
  "sensors.color3|block": "color sensor 3",
 | 
			
		||||
  "sensors.color4|block": "color sensor 4",
 | 
			
		||||
  "sensors.gyro1|block": "gyro sensor 1",
 | 
			
		||||
  "sensors.gyro2|block": "gyro sensor 2",
 | 
			
		||||
  "sensors.gyro3|block": "gyro sensor 3",
 | 
			
		||||
  "sensors.gyro4|block": "gyro sensor 4",
 | 
			
		||||
  "sensors.infraredSensor1|block": "`icons.infraredSensor` 1",
 | 
			
		||||
  "sensors.infraredSensor2|block": "`icons.infraredSensor` 2",
 | 
			
		||||
  "sensors.infraredSensor3|block": "`icons.infraredSensor` 3",
 | 
			
		||||
  "sensors.infraredSensor4|block": "`icons.infraredSensor` 4",
 | 
			
		||||
  "sensors.TouchSensor.isTouched|block": "`icons.touchSensor` %sensor|is touched",
 | 
			
		||||
  "sensors.TouchSensor.onEvent|block": "on `icons.touchSensor` %sensor|%event",
 | 
			
		||||
  "sensors.UltraSonicSensor.distance|block": "`icons.ultrasonicSensor` %sensor|distance",
 | 
			
		||||
  "sensors.UltraSonicSensor.on|block": "on `icons.ultrasonicSensor` %sensor|%event",
 | 
			
		||||
  "sensors.UltraSonicSensor.wait|block": "wait `icons.ultrasonicSensor` %sensor|for %event",
 | 
			
		||||
  "sensors.color1|block": "1",
 | 
			
		||||
  "sensors.color2|block": "2",
 | 
			
		||||
  "sensors.color3|block": "3",
 | 
			
		||||
  "sensors.color4|block": "4",
 | 
			
		||||
  "sensors.gyro1|block": "1",
 | 
			
		||||
  "sensors.gyro2|block": "2",
 | 
			
		||||
  "sensors.gyro3|block": "3",
 | 
			
		||||
  "sensors.gyro4|block": "4",
 | 
			
		||||
  "sensors.infraredSensor1|block": "1",
 | 
			
		||||
  "sensors.infraredSensor2|block": "2",
 | 
			
		||||
  "sensors.infraredSensor3|block": "3",
 | 
			
		||||
  "sensors.infraredSensor4|block": "4",
 | 
			
		||||
  "sensors.remoteButtonBottomLeft|block": "remote button bottom-left",
 | 
			
		||||
  "sensors.remoteButtonBottomRight|block": "remote button bottom-right",
 | 
			
		||||
  "sensors.remoteButtonCenter|block": "remote button center",
 | 
			
		||||
  "sensors.remoteButtonTopLeft|block": "remote button top-left",
 | 
			
		||||
  "sensors.remoteButtonTopRight|block": "remote button top-right",
 | 
			
		||||
  "sensors.touchSensor1|block": "`icons.touchSensor` 1",
 | 
			
		||||
  "sensors.touchSensor2|block": "`icons.touchSensor` 2",
 | 
			
		||||
  "sensors.touchSensor3|block": "`icons.touchSensor` 3",
 | 
			
		||||
  "sensors.touchSensor4|block": "`icons.touchSensor` 4",
 | 
			
		||||
  "sensors.ultrasonic1|block": "`icons.ultrasonicSensor` 1",
 | 
			
		||||
  "sensors.ultrasonic2|block": "`icons.ultrasonicSensor` 2",
 | 
			
		||||
  "sensors.ultrasonic3|block": "`icons.ultrasonicSensor` 3",
 | 
			
		||||
  "sensors.ultrasonic4|block": "`icons.ultrasonicSensor` 4",
 | 
			
		||||
  "sensors.touchSensor1|block": "1",
 | 
			
		||||
  "sensors.touchSensor2|block": "2",
 | 
			
		||||
  "sensors.touchSensor3|block": "3",
 | 
			
		||||
  "sensors.touchSensor4|block": "4",
 | 
			
		||||
  "sensors.ultrasonic1|block": "1",
 | 
			
		||||
  "sensors.ultrasonic2|block": "2",
 | 
			
		||||
  "sensors.ultrasonic3|block": "3",
 | 
			
		||||
  "sensors.ultrasonic4|block": "4",
 | 
			
		||||
  "sensors|block": "sensors",
 | 
			
		||||
  "serial|block": "serial",
 | 
			
		||||
  "{id:category}Brick": "Brick",
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ namespace sensors {
 | 
			
		||||
         * @param handler the code to run when detected
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/color/on-color-detected
 | 
			
		||||
        //% block="on %sensor|detected %color"
 | 
			
		||||
        //% block="on `icons.colorSensor` %sensor|detected %color"
 | 
			
		||||
        //% blockId=colorOnColorDetected
 | 
			
		||||
        //% parts="colorsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -77,7 +77,7 @@ namespace sensors {
 | 
			
		||||
         * @param color the color sensor to query the request
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/color/ambient-light
 | 
			
		||||
        //% block="%color| ambient light"
 | 
			
		||||
        //% block="`icons.colorSensor` %color| ambient light"
 | 
			
		||||
        //% blockId=colorGetAmbient
 | 
			
		||||
        //% parts="colorsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -93,7 +93,7 @@ namespace sensors {
 | 
			
		||||
         * @param color the color sensor to query the request
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/color/refelected-light
 | 
			
		||||
        //% block="%color| reflected light"
 | 
			
		||||
        //% block="`icons.colorSensor` %color| reflected light"
 | 
			
		||||
        //% blockId=colorGetReflected
 | 
			
		||||
        //% parts="colorsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -109,7 +109,7 @@ namespace sensors {
 | 
			
		||||
         * @param color the color sensor to query the request
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/color/color
 | 
			
		||||
        //% block="%color| color"
 | 
			
		||||
        //% block="`icons.colorSensor` %color| color"
 | 
			
		||||
        //% blockId=colorGetColor
 | 
			
		||||
        //% parts="colorsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -121,15 +121,15 @@ namespace sensors {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //% whenUsed block="color sensor 3" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="1" weight=95 fixedInstance
 | 
			
		||||
    export const color1: ColorSensor = new ColorSensor(1)
 | 
			
		||||
    
 | 
			
		||||
    //% whenUsed block="3" weight=90 fixedInstance
 | 
			
		||||
    export const color3: ColorSensor = new ColorSensor(3)
 | 
			
		||||
    
 | 
			
		||||
    //% whenUsed block="color sensor 1" weight=95 fixedInstance
 | 
			
		||||
    export const color1: ColorSensor = new ColorSensor(1)
 | 
			
		||||
 | 
			
		||||
    //% whenUsed block="color sensor 2" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="2" weight=90 fixedInstance
 | 
			
		||||
    export const color2: ColorSensor = new ColorSensor(2)
 | 
			
		||||
 | 
			
		||||
    //% whenUsed block="color sensor 4" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="4" weight=90 fixedInstance
 | 
			
		||||
    export const color4: ColorSensor = new ColorSensor(4)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ namespace sensors {
 | 
			
		||||
         * @param sensor the gyroscope to query the request
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/gyro/angle
 | 
			
		||||
        //% block="%sensor|angle"
 | 
			
		||||
        //% block="`icons.gyroSensor` %sensor|angle"
 | 
			
		||||
        //% blockId=gyroGetAngle
 | 
			
		||||
        //% parts="gyroscope"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -40,7 +40,7 @@ namespace sensors {
 | 
			
		||||
         * @param sensor the gyroscope to query the request
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/gyro/rate
 | 
			
		||||
        //% block="%sensor|rotation rate"
 | 
			
		||||
        //% block="`icons.gyroSensor` %sensor|rotation rate"
 | 
			
		||||
        //% blockId=gyroGetRate
 | 
			
		||||
        //% parts="gyroscope"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -51,16 +51,16 @@ namespace sensors {
 | 
			
		||||
            return this.getNumber(NumberFormat.Int16LE, 0)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="gyro sensor 2"
 | 
			
		||||
    export const gyro2: GyroSensor = new GyroSensor(2)
 | 
			
		||||
    
 | 
			
		||||
    //% fixedInstance whenUsed block="gyro sensor 1"
 | 
			
		||||
    //% fixedInstance whenUsed block="1"
 | 
			
		||||
    export const gyro1: GyroSensor = new GyroSensor(1)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="gyro sensor 3"
 | 
			
		||||
    //% fixedInstance whenUsed block="2" weight=95
 | 
			
		||||
    export const gyro2: GyroSensor = new GyroSensor(2)
 | 
			
		||||
    
 | 
			
		||||
    //% fixedInstance whenUsed block="3"
 | 
			
		||||
    export const gyro3: GyroSensor = new GyroSensor(3)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="gyro sensor 4"
 | 
			
		||||
    //% fixedInstance whenUsed block="4"
 | 
			
		||||
    export const gyro4: GyroSensor = new GyroSensor(4)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -193,7 +193,7 @@ namespace sensors {
 | 
			
		||||
         * @param handler the code to run when detected
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/infrared/on
 | 
			
		||||
        //% block="on %sensor|%event"
 | 
			
		||||
        //% block="on `icons.infraredSensor` %sensor|%event"
 | 
			
		||||
        //% blockId=infraredOn
 | 
			
		||||
        //% parts="infraredsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -209,7 +209,7 @@ namespace sensors {
 | 
			
		||||
         * Waits for the event to occur
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/ultrasonic/wait
 | 
			
		||||
        //% block="wait %sensor|for %event"
 | 
			
		||||
        //% block="wait `icons.infraredSensor` %sensor|for %event"
 | 
			
		||||
        //% blockId=infraredwait
 | 
			
		||||
        //% parts="infraredsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -224,7 +224,7 @@ namespace sensors {
 | 
			
		||||
         * @param ir the infrared sensor
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/infrared/proximity
 | 
			
		||||
        //% block="%infrared|proximity"
 | 
			
		||||
        //% block="`icons.infraredSensor` %infrared|proximity"
 | 
			
		||||
        //% blockId=infraredGetProximity
 | 
			
		||||
        //% parts="infrared"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -240,7 +240,7 @@ namespace sensors {
 | 
			
		||||
         * @param ir the infrared sensor
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/infrared/remote-command
 | 
			
		||||
        //% block="%infrared|remote command"
 | 
			
		||||
        //% block="`icons.infraredSensor` %infrared|remote command"
 | 
			
		||||
        //% blockId=infraredGetRemoteCommand
 | 
			
		||||
        //% parts="infrared"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -258,16 +258,16 @@ namespace sensors {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.infraredSensor` 1"
 | 
			
		||||
    //% fixedInstance whenUsed block="1"
 | 
			
		||||
    export const infraredSensor1: InfraredSensor = new InfraredSensor(1)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.infraredSensor` 2"
 | 
			
		||||
    //% fixedInstance whenUsed block="2"
 | 
			
		||||
    export const infraredSensor2: InfraredSensor = new InfraredSensor(2)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.infraredSensor` 3"
 | 
			
		||||
    //% fixedInstance whenUsed block="3"
 | 
			
		||||
    export const infraredSensor3: InfraredSensor = new InfraredSensor(3)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.infraredSensor` 4"
 | 
			
		||||
    //% fixedInstance whenUsed block="4"
 | 
			
		||||
    export const infraredSensor4: InfraredSensor = new InfraredSensor(4)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								libs/core/jres/icons/colorSensor-icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/core/jres/icons/colorSensor-icon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 5.2 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								libs/core/jres/icons/gyroSensor-icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/core/jres/icons/gyroSensor-icon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 4.8 KiB  | 
@@ -216,28 +216,28 @@ namespace motors {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorLarge` A"
 | 
			
		||||
    //% whenUsed fixedInstance block="large A"
 | 
			
		||||
    export const largeMotorA = new Motor(Output.A, true);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorLarge` B"
 | 
			
		||||
    //% whenUsed fixedInstance block="large B"
 | 
			
		||||
    export const largeMotorB = new Motor(Output.B, true);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorLarge` C"
 | 
			
		||||
    //% whenUsed fixedInstance block="large C"
 | 
			
		||||
    export const largeMotorC = new Motor(Output.C, true);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorLarge` D"
 | 
			
		||||
    //% whenUsed fixedInstance block="large D"
 | 
			
		||||
    export const largeMotorD = new Motor(Output.D, true);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorMedium` A"
 | 
			
		||||
    //% whenUsed fixedInstance block="medium A"
 | 
			
		||||
    export const mediumMotorA = new Motor(Output.A, false);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorMedium` B"
 | 
			
		||||
    //% whenUsed fixedInstance block="medium B"
 | 
			
		||||
    export const mediumMotorB = new Motor(Output.B, false);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorMedium` C"
 | 
			
		||||
    //% whenUsed fixedInstance block="medium C"
 | 
			
		||||
    export const mediumMotorC = new Motor(Output.C, false);
 | 
			
		||||
 | 
			
		||||
    //% whenUsed fixedInstance block="`icons.motorMedium` D"
 | 
			
		||||
    //% whenUsed fixedInstance block="medium D"
 | 
			
		||||
    export const mediumMotorD = new Motor(Output.D, false);
 | 
			
		||||
 | 
			
		||||
    function reset(out: Output) {
 | 
			
		||||
 
 | 
			
		||||
@@ -35,12 +35,28 @@ namespace sensors {
 | 
			
		||||
            return DAL.DEVICE_TYPE_TOUCH
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Do something when a touch sensor is touched...
 | 
			
		||||
         * @param sensor the touch sensor that needs to be clicked or used
 | 
			
		||||
         * @param event the kind of button gesture that needs to be detected
 | 
			
		||||
         * @param body code to run when the event is raised
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/touch/on-event
 | 
			
		||||
        //% blockId=touchEvent block="on `icons.touchSensor` %sensor|%event"
 | 
			
		||||
        //% parts="touch"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
        //% weight=99 blockGap=8
 | 
			
		||||
        //% group="Touch Sensor"
 | 
			
		||||
        onEvent(ev: TouchSensorEvent, body: () => void) {
 | 
			
		||||
            this.button.onEvent(<ButtonEvent><number>ev, body)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Check if touch sensor is touched.
 | 
			
		||||
         * @param sensor the port to query the request
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/touch/is-touched
 | 
			
		||||
        //% block="%sensor|is touched"
 | 
			
		||||
        //% block="`icons.touchSensor` %sensor|is touched"
 | 
			
		||||
        //% blockId=touchIsTouched
 | 
			
		||||
        //% parts="touch"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
@@ -49,30 +65,14 @@ namespace sensors {
 | 
			
		||||
        isTouched() {
 | 
			
		||||
            return this.button.isPressed();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Do something when a touch sensor is touched...
 | 
			
		||||
         * @param sensor the touch sensor that needs to be clicked or used
 | 
			
		||||
         * @param event the kind of button gesture that needs to be detected
 | 
			
		||||
         * @param body code to run when the event is raised
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/touch/on-event
 | 
			
		||||
        //% blockId=touchEvent block="on %sensor|%event"
 | 
			
		||||
        //% parts="touch"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
        //% weight=99 blockGap=8
 | 
			
		||||
        //% group="Touch Sensor"
 | 
			
		||||
        onEvent(ev: TouchSensorEvent, body: () => void) {
 | 
			
		||||
            this.button.onEvent(<ButtonEvent><number>ev, body)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //% whenUsed block="`icons.touchSensor` 1" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="1" weight=95 fixedInstance
 | 
			
		||||
    export const touchSensor1: TouchSensor = new TouchSensor(1)
 | 
			
		||||
    //% whenUsed block="`icons.touchSensor` 2" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="2" weight=95 fixedInstance
 | 
			
		||||
    export const touchSensor2: TouchSensor = new TouchSensor(2)
 | 
			
		||||
    //% whenUsed block="`icons.touchSensor` 3" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="3" weight=95 fixedInstance
 | 
			
		||||
    export const touchSensor3: TouchSensor = new TouchSensor(3)
 | 
			
		||||
    //% whenUsed block="`icons.touchSensor` 4" weight=95 fixedInstance
 | 
			
		||||
    //% whenUsed block="4" weight=95 fixedInstance
 | 
			
		||||
    export const touchSensor4: TouchSensor = new TouchSensor(4)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -41,9 +41,9 @@ namespace sensors {
 | 
			
		||||
         * @param handler the code to run when detected
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/ultrasonic/on
 | 
			
		||||
        //% block="on %sensor|%event"
 | 
			
		||||
        //% blockId=ultrasonicOn
 | 
			
		||||
        //% parts="infraredsensor"
 | 
			
		||||
        //% block="on `icons.ultrasonicSensor` %sensor|%event"
 | 
			
		||||
        //% parts="ultrasonicsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
        //% weight=100 blockGap=8
 | 
			
		||||
        //% group="Ultrasonic Sensor"
 | 
			
		||||
@@ -58,9 +58,9 @@ namespace sensors {
 | 
			
		||||
         * Waits for the event to occur
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/ultrasonic/wait
 | 
			
		||||
        //% block="wait %sensor|for %event"
 | 
			
		||||
        //% block="wait `icons.ultrasonicSensor` %sensor|for %event"
 | 
			
		||||
        //% blockId=ultrasonicWait
 | 
			
		||||
        //% parts="infraredsensor"
 | 
			
		||||
        //% parts="ultrasonicsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
        //% weight=99 blockGap=8
 | 
			
		||||
        //% group="Ultrasonic Sensor"        
 | 
			
		||||
@@ -73,9 +73,9 @@ namespace sensors {
 | 
			
		||||
         * @param sensor the ultrasonic sensor port
 | 
			
		||||
         */
 | 
			
		||||
        //% help=input/ultrasonic/distance
 | 
			
		||||
        //% block="%sensor|distance"
 | 
			
		||||
        //% block="`icons.ultrasonicSensor` %sensor|distance"
 | 
			
		||||
        //% blockId=sonarGetDistance
 | 
			
		||||
        //% parts="ultrasonic"
 | 
			
		||||
        //% parts="ultrasonicsensor"
 | 
			
		||||
        //% blockNamespace=sensors
 | 
			
		||||
        //% weight=65 blockGap=8   
 | 
			
		||||
        //% group="Ultrasonic Sensor"     
 | 
			
		||||
@@ -86,15 +86,15 @@ namespace sensors {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.ultrasonicSensor` 1"
 | 
			
		||||
    //% fixedInstance whenUsed block="1"
 | 
			
		||||
    export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1)
 | 
			
		||||
    
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.ultrasonicSensor` 4"
 | 
			
		||||
    //% fixedInstance whenUsed block="4"
 | 
			
		||||
    export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.ultrasonicSensor` 2"
 | 
			
		||||
    //% fixedInstance whenUsed block="2"
 | 
			
		||||
    export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2)
 | 
			
		||||
 | 
			
		||||
    //% fixedInstance whenUsed block="`icons.ultrasonicSensor` 3"
 | 
			
		||||
    //% fixedInstance whenUsed block="3"
 | 
			
		||||
    export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user