more images

This commit is contained in:
Peli de Halleux 2017-11-16 12:58:37 -08:00
parent dab281a9cb
commit 9437873427
10 changed files with 114 additions and 108 deletions

View File

@ -55,61 +55,61 @@
"motors.Motor.speed|block": "%motor|speed", "motors.Motor.speed|block": "%motor|speed",
"motors.Motor.stop|block": "stop %motor", "motors.Motor.stop|block": "stop %motor",
"motors.Motor.tachoCount|block": "%motor|tacho count", "motors.Motor.tachoCount|block": "%motor|tacho count",
"motors.largeMotorA|block": "`icons.motorLarge` A", "motors.largeMotorA|block": "large A",
"motors.largeMotorB|block": "`icons.motorLarge` B", "motors.largeMotorB|block": "large B",
"motors.largeMotorC|block": "`icons.motorLarge` C", "motors.largeMotorC|block": "large C",
"motors.largeMotorD|block": "`icons.motorLarge` D", "motors.largeMotorD|block": "large D",
"motors.mediumMotorA|block": "`icons.motorMedium` A", "motors.mediumMotorA|block": "medium A",
"motors.mediumMotorB|block": "`icons.motorMedium` B", "motors.mediumMotorB|block": "medium B",
"motors.mediumMotorC|block": "`icons.motorMedium` C", "motors.mediumMotorC|block": "medium C",
"motors.mediumMotorD|block": "`icons.motorMedium` D", "motors.mediumMotorD|block": "medium D",
"motors.stopAllMotors|block": "stop all motors", "motors.stopAllMotors|block": "stop all motors",
"motors|block": "motors", "motors|block": "motors",
"output|block": "output", "output|block": "output",
"screen|block": "screen", "screen|block": "screen",
"sensors.ColorSensor.ambientLight|block": "%color| ambient light", "sensors.ColorSensor.ambientLight|block": "`icons.colorSensor` %color| ambient light",
"sensors.ColorSensor.color|block": "%color| color", "sensors.ColorSensor.color|block": "`icons.colorSensor` %color| color",
"sensors.ColorSensor.onColorDetected|block": "on %sensor|detected %color", "sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected %color",
"sensors.ColorSensor.reflectedLight|block": "%color| reflected light", "sensors.ColorSensor.reflectedLight|block": "`icons.colorSensor` %color| reflected light",
"sensors.GyroSensor.angle|block": "%sensor|angle", "sensors.GyroSensor.angle|block": "`icons.gyroSensor` %sensor|angle",
"sensors.GyroSensor.rate|block": "%sensor|rotation rate", "sensors.GyroSensor.rate|block": "`icons.gyroSensor` %sensor|rotation rate",
"sensors.InfraredSensor.on|block": "on %sensor|%event", "sensors.InfraredSensor.on|block": "on `icons.infraredSensor` %sensor|%event",
"sensors.InfraredSensor.proximity|block": "%infrared|proximity", "sensors.InfraredSensor.proximity|block": "`icons.infraredSensor` %infrared|proximity",
"sensors.InfraredSensor.remoteCommand|block": "%infrared|remote command", "sensors.InfraredSensor.remoteCommand|block": "`icons.infraredSensor` %infrared|remote command",
"sensors.InfraredSensor.wait|block": "wait %sensor|for %event", "sensors.InfraredSensor.wait|block": "wait `icons.infraredSensor` %sensor|for %event",
"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",
"sensors.TouchSensor.isTouched|block": "%sensor|is touched", "sensors.TouchSensor.isTouched|block": "`icons.touchSensor` %sensor|is touched",
"sensors.TouchSensor.onEvent|block": "on %sensor|%event", "sensors.TouchSensor.onEvent|block": "on `icons.touchSensor` %sensor|%event",
"sensors.UltraSonicSensor.distance|block": "%sensor|distance", "sensors.UltraSonicSensor.distance|block": "`icons.ultrasonicSensor` %sensor|distance",
"sensors.UltraSonicSensor.on|block": "on %sensor|%event", "sensors.UltraSonicSensor.on|block": "on `icons.ultrasonicSensor` %sensor|%event",
"sensors.UltraSonicSensor.wait|block": "wait %sensor|for %event", "sensors.UltraSonicSensor.wait|block": "wait `icons.ultrasonicSensor` %sensor|for %event",
"sensors.color1|block": "color sensor 1", "sensors.color1|block": "1",
"sensors.color2|block": "color sensor 2", "sensors.color2|block": "2",
"sensors.color3|block": "color sensor 3", "sensors.color3|block": "3",
"sensors.color4|block": "color sensor 4", "sensors.color4|block": "4",
"sensors.gyro1|block": "gyro sensor 1", "sensors.gyro1|block": "1",
"sensors.gyro2|block": "gyro sensor 2", "sensors.gyro2|block": "2",
"sensors.gyro3|block": "gyro sensor 3", "sensors.gyro3|block": "3",
"sensors.gyro4|block": "gyro sensor 4", "sensors.gyro4|block": "4",
"sensors.infraredSensor1|block": "`icons.infraredSensor` 1", "sensors.infraredSensor1|block": "1",
"sensors.infraredSensor2|block": "`icons.infraredSensor` 2", "sensors.infraredSensor2|block": "2",
"sensors.infraredSensor3|block": "`icons.infraredSensor` 3", "sensors.infraredSensor3|block": "3",
"sensors.infraredSensor4|block": "`icons.infraredSensor` 4", "sensors.infraredSensor4|block": "4",
"sensors.remoteButtonBottomLeft|block": "remote button bottom-left", "sensors.remoteButtonBottomLeft|block": "remote button bottom-left",
"sensors.remoteButtonBottomRight|block": "remote button bottom-right", "sensors.remoteButtonBottomRight|block": "remote button bottom-right",
"sensors.remoteButtonCenter|block": "remote button center", "sensors.remoteButtonCenter|block": "remote button center",
"sensors.remoteButtonTopLeft|block": "remote button top-left", "sensors.remoteButtonTopLeft|block": "remote button top-left",
"sensors.remoteButtonTopRight|block": "remote button top-right", "sensors.remoteButtonTopRight|block": "remote button top-right",
"sensors.touchSensor1|block": "`icons.touchSensor` 1", "sensors.touchSensor1|block": "1",
"sensors.touchSensor2|block": "`icons.touchSensor` 2", "sensors.touchSensor2|block": "2",
"sensors.touchSensor3|block": "`icons.touchSensor` 3", "sensors.touchSensor3|block": "3",
"sensors.touchSensor4|block": "`icons.touchSensor` 4", "sensors.touchSensor4|block": "4",
"sensors.ultrasonic1|block": "`icons.ultrasonicSensor` 1", "sensors.ultrasonic1|block": "1",
"sensors.ultrasonic2|block": "`icons.ultrasonicSensor` 2", "sensors.ultrasonic2|block": "2",
"sensors.ultrasonic3|block": "`icons.ultrasonicSensor` 3", "sensors.ultrasonic3|block": "3",
"sensors.ultrasonic4|block": "`icons.ultrasonicSensor` 4", "sensors.ultrasonic4|block": "4",
"sensors|block": "sensors", "sensors|block": "sensors",
"serial|block": "serial", "serial|block": "serial",
"{id:category}Brick": "Brick", "{id:category}Brick": "Brick",

View File

@ -59,7 +59,7 @@ namespace sensors {
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=input/color/on-color-detected //% help=input/color/on-color-detected
//% block="on %sensor|detected %color" //% block="on `icons.colorSensor` %sensor|detected %color"
//% blockId=colorOnColorDetected //% blockId=colorOnColorDetected
//% parts="colorsensor" //% parts="colorsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -77,7 +77,7 @@ namespace sensors {
* @param color the color sensor to query the request * @param color the color sensor to query the request
*/ */
//% help=input/color/ambient-light //% help=input/color/ambient-light
//% block="%color| ambient light" //% block="`icons.colorSensor` %color| ambient light"
//% blockId=colorGetAmbient //% blockId=colorGetAmbient
//% parts="colorsensor" //% parts="colorsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -93,7 +93,7 @@ namespace sensors {
* @param color the color sensor to query the request * @param color the color sensor to query the request
*/ */
//% help=input/color/refelected-light //% help=input/color/refelected-light
//% block="%color| reflected light" //% block="`icons.colorSensor` %color| reflected light"
//% blockId=colorGetReflected //% blockId=colorGetReflected
//% parts="colorsensor" //% parts="colorsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -109,7 +109,7 @@ namespace sensors {
* @param color the color sensor to query the request * @param color the color sensor to query the request
*/ */
//% help=input/color/color //% help=input/color/color
//% block="%color| color" //% block="`icons.colorSensor` %color| color"
//% blockId=colorGetColor //% blockId=colorGetColor
//% parts="colorsensor" //% parts="colorsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -121,15 +121,15 @@ namespace sensors {
} }
} }
//% whenUsed block="color sensor 3" weight=95 fixedInstance //% whenUsed block="1" weight=95 fixedInstance
export const color3: ColorSensor = new ColorSensor(3)
//% whenUsed block="color sensor 1" weight=95 fixedInstance
export const color1: ColorSensor = new ColorSensor(1) export const color1: ColorSensor = new ColorSensor(1)
//% whenUsed block="color sensor 2" weight=95 fixedInstance //% whenUsed block="3" weight=90 fixedInstance
export const color3: ColorSensor = new ColorSensor(3)
//% whenUsed block="2" weight=90 fixedInstance
export const color2: ColorSensor = new ColorSensor(2) 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) export const color4: ColorSensor = new ColorSensor(4)
} }

View File

@ -24,7 +24,7 @@ namespace sensors {
* @param sensor the gyroscope to query the request * @param sensor the gyroscope to query the request
*/ */
//% help=input/gyro/angle //% help=input/gyro/angle
//% block="%sensor|angle" //% block="`icons.gyroSensor` %sensor|angle"
//% blockId=gyroGetAngle //% blockId=gyroGetAngle
//% parts="gyroscope" //% parts="gyroscope"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -40,7 +40,7 @@ namespace sensors {
* @param sensor the gyroscope to query the request * @param sensor the gyroscope to query the request
*/ */
//% help=input/gyro/rate //% help=input/gyro/rate
//% block="%sensor|rotation rate" //% block="`icons.gyroSensor` %sensor|rotation rate"
//% blockId=gyroGetRate //% blockId=gyroGetRate
//% parts="gyroscope" //% parts="gyroscope"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -52,15 +52,15 @@ namespace sensors {
} }
} }
//% fixedInstance whenUsed block="gyro sensor 2" //% fixedInstance whenUsed block="1"
export const gyro2: GyroSensor = new GyroSensor(2)
//% fixedInstance whenUsed block="gyro sensor 1"
export const gyro1: GyroSensor = new GyroSensor(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) export const gyro3: GyroSensor = new GyroSensor(3)
//% fixedInstance whenUsed block="gyro sensor 4" //% fixedInstance whenUsed block="4"
export const gyro4: GyroSensor = new GyroSensor(4) export const gyro4: GyroSensor = new GyroSensor(4)
} }

File diff suppressed because one or more lines are too long

View File

@ -193,7 +193,7 @@ namespace sensors {
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=input/infrared/on //% help=input/infrared/on
//% block="on %sensor|%event" //% block="on `icons.infraredSensor` %sensor|%event"
//% blockId=infraredOn //% blockId=infraredOn
//% parts="infraredsensor" //% parts="infraredsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -209,7 +209,7 @@ namespace sensors {
* Waits for the event to occur * Waits for the event to occur
*/ */
//% help=input/ultrasonic/wait //% help=input/ultrasonic/wait
//% block="wait %sensor|for %event" //% block="wait `icons.infraredSensor` %sensor|for %event"
//% blockId=infraredwait //% blockId=infraredwait
//% parts="infraredsensor" //% parts="infraredsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -224,7 +224,7 @@ namespace sensors {
* @param ir the infrared sensor * @param ir the infrared sensor
*/ */
//% help=input/infrared/proximity //% help=input/infrared/proximity
//% block="%infrared|proximity" //% block="`icons.infraredSensor` %infrared|proximity"
//% blockId=infraredGetProximity //% blockId=infraredGetProximity
//% parts="infrared" //% parts="infrared"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -240,7 +240,7 @@ namespace sensors {
* @param ir the infrared sensor * @param ir the infrared sensor
*/ */
//% help=input/infrared/remote-command //% help=input/infrared/remote-command
//% block="%infrared|remote command" //% block="`icons.infraredSensor` %infrared|remote command"
//% blockId=infraredGetRemoteCommand //% blockId=infraredGetRemoteCommand
//% parts="infrared" //% parts="infrared"
//% blockNamespace=sensors //% 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) export const infraredSensor1: InfraredSensor = new InfraredSensor(1)
//% fixedInstance whenUsed block="`icons.infraredSensor` 2" //% fixedInstance whenUsed block="2"
export const infraredSensor2: InfraredSensor = new InfraredSensor(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) export const infraredSensor3: InfraredSensor = new InfraredSensor(3)
//% fixedInstance whenUsed block="`icons.infraredSensor` 4" //% fixedInstance whenUsed block="4"
export const infraredSensor4: InfraredSensor = new InfraredSensor(4) export const infraredSensor4: InfraredSensor = new InfraredSensor(4)

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -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); 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); 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); 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); 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); 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); 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); 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); export const mediumMotorD = new Motor(Output.D, false);
function reset(out: Output) { function reset(out: Output) {

View File

@ -35,12 +35,28 @@ namespace sensors {
return DAL.DEVICE_TYPE_TOUCH 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. * Check if touch sensor is touched.
* @param sensor the port to query the request * @param sensor the port to query the request
*/ */
//% help=input/touch/is-touched //% help=input/touch/is-touched
//% block="%sensor|is touched" //% block="`icons.touchSensor` %sensor|is touched"
//% blockId=touchIsTouched //% blockId=touchIsTouched
//% parts="touch" //% parts="touch"
//% blockNamespace=sensors //% blockNamespace=sensors
@ -49,30 +65,14 @@ namespace sensors {
isTouched() { isTouched() {
return this.button.isPressed(); 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) 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) 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) 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) export const touchSensor4: TouchSensor = new TouchSensor(4)
} }

View File

@ -41,9 +41,9 @@ namespace sensors {
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=input/ultrasonic/on //% help=input/ultrasonic/on
//% block="on %sensor|%event"
//% blockId=ultrasonicOn //% blockId=ultrasonicOn
//% parts="infraredsensor" //% block="on `icons.ultrasonicSensor` %sensor|%event"
//% parts="ultrasonicsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=100 blockGap=8 //% weight=100 blockGap=8
//% group="Ultrasonic Sensor" //% group="Ultrasonic Sensor"
@ -58,9 +58,9 @@ namespace sensors {
* Waits for the event to occur * Waits for the event to occur
*/ */
//% help=input/ultrasonic/wait //% help=input/ultrasonic/wait
//% block="wait %sensor|for %event" //% block="wait `icons.ultrasonicSensor` %sensor|for %event"
//% blockId=ultrasonicWait //% blockId=ultrasonicWait
//% parts="infraredsensor" //% parts="ultrasonicsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=99 blockGap=8 //% weight=99 blockGap=8
//% group="Ultrasonic Sensor" //% group="Ultrasonic Sensor"
@ -73,9 +73,9 @@ namespace sensors {
* @param sensor the ultrasonic sensor port * @param sensor the ultrasonic sensor port
*/ */
//% help=input/ultrasonic/distance //% help=input/ultrasonic/distance
//% block="%sensor|distance" //% block="`icons.ultrasonicSensor` %sensor|distance"
//% blockId=sonarGetDistance //% blockId=sonarGetDistance
//% parts="ultrasonic" //% parts="ultrasonicsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Ultrasonic Sensor" //% 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) export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1)
//% fixedInstance whenUsed block="`icons.ultrasonicSensor` 4" //% fixedInstance whenUsed block="4"
export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(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) export const ultrasonic2: UltraSonicSensor = new UltraSonicSensor(2)
//% fixedInstance whenUsed block="`icons.ultrasonicSensor` 3" //% fixedInstance whenUsed block="3"
export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3) export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3)
} }