renaming IR events
This commit is contained in:
parent
0e1a3b7e6b
commit
59ce4338d3
@ -29,8 +29,8 @@
|
||||
"input.ColorSensor.reflectedLight": "Get current reflected light value from the color sensor.",
|
||||
"input.GyroSensor.angle": "Get the current angle from the gyroscope.",
|
||||
"input.GyroSensor.rate": "Get the current rotation rate from the gyroscope.",
|
||||
"input.IrSensor.distance": "Get the distance measured by the infrared sensor.",
|
||||
"input.IrSensor.remoteCommand": "Get the remote commandreceived the infrared sensor.",
|
||||
"input.InfraredSensor.proximity": "Get the promixity measured by the infrared sensor, from ``0`` (close) to ``100`` (far)",
|
||||
"input.InfraredSensor.remoteCommand": "Get the remote commandreceived the infrared sensor.",
|
||||
"input.TouchSensor.isTouched": "Check if touch sensor is touched.",
|
||||
"input.TouchSensor.onEvent": "Do something when a touch sensor is touched...",
|
||||
"input.TouchSensor.onEvent|param|body": "code to run when the event is raised",
|
||||
|
@ -30,8 +30,8 @@
|
||||
"input.ColorSensor.reflectedLight|block": "%color| reflected light",
|
||||
"input.GyroSensor.angle|block": "%sensor|angle",
|
||||
"input.GyroSensor.rate|block": "%sensor|rotation rate",
|
||||
"input.IrSensor.distance|block": "%infrared|distance",
|
||||
"input.IrSensor.remoteCommand|block": "%infrared|remote command",
|
||||
"input.InfraredSensor.proximity|block": "%infrared|proximity",
|
||||
"input.InfraredSensor.remoteCommand|block": "%infrared|remote command",
|
||||
"input.TouchSensor.isTouched|block": "%sensor|is touched",
|
||||
"input.TouchSensor.onEvent|block": "on %sensor|%event",
|
||||
"input.UltraSonicSensor.distance|block": "%sensor|distance",
|
||||
|
@ -42,7 +42,7 @@ namespace input {
|
||||
|
||||
let buttons: Button[]
|
||||
|
||||
function create(ir: IrSensor) {
|
||||
function create(ir: InfraredSensor) {
|
||||
// it's created by referencing it
|
||||
}
|
||||
|
||||
@ -54,10 +54,10 @@ namespace input {
|
||||
}
|
||||
|
||||
// make sure sensors are up
|
||||
create(ir1)
|
||||
create(ir2)
|
||||
create(ir3)
|
||||
create(ir4)
|
||||
create(infrared1)
|
||||
create(infrared2)
|
||||
create(infrared3)
|
||||
create(infrared4)
|
||||
}
|
||||
|
||||
let num = -1
|
||||
@ -69,8 +69,8 @@ namespace input {
|
||||
return buttons[num]
|
||||
}
|
||||
|
||||
//% fixedInstance
|
||||
export class IrSensor extends internal.UartSensor {
|
||||
//% fixedInstances
|
||||
export class InfraredSensor extends internal.UartSensor {
|
||||
private channel: IrRemoteChannel
|
||||
|
||||
constructor(port: number) {
|
||||
@ -110,17 +110,17 @@ namespace input {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the distance measured by the infrared sensor.
|
||||
* Get the promixity measured by the infrared sensor, from ``0`` (close) to ``100`` (far)
|
||||
* @param ir the infrared sensor
|
||||
*/
|
||||
//% help=input/infrared/distance
|
||||
//% block="%infrared|distance"
|
||||
//% blockId=infraredGetDistance
|
||||
//% help=input/infrared/proximity
|
||||
//% block="%infrared|proximity"
|
||||
//% blockId=infraredGetProximity
|
||||
//% parts="infrared"
|
||||
//% blockNamespace=input
|
||||
//% weight=65 blockGap=8
|
||||
//% group="Infrared Sensor"
|
||||
distance() {
|
||||
proximity() {
|
||||
this.setMode(IrSensorMode.Proximity)
|
||||
return this.getNumber(NumberFormat.UInt8LE, 0)
|
||||
}
|
||||
@ -148,17 +148,17 @@ namespace input {
|
||||
}
|
||||
}
|
||||
|
||||
//% whenUsed
|
||||
export const ir1: IrSensor = new IrSensor(1)
|
||||
//% fixedInstance whenUsed
|
||||
export const infrared1: InfraredSensor = new InfraredSensor(1)
|
||||
|
||||
//% whenUsed
|
||||
export const ir2: IrSensor = new IrSensor(2)
|
||||
//% fixedInstance whenUsed
|
||||
export const infrared2: InfraredSensor = new InfraredSensor(2)
|
||||
|
||||
//% whenUsed
|
||||
export const ir3: IrSensor = new IrSensor(3)
|
||||
//% fixedInstance whenUsed
|
||||
export const infrared3: InfraredSensor = new InfraredSensor(3)
|
||||
|
||||
//% whenUsed
|
||||
export const ir4: IrSensor = new IrSensor(4)
|
||||
//% fixedInstance whenUsed
|
||||
export const infrared4: InfraredSensor = new InfraredSensor(4)
|
||||
|
||||
/**
|
||||
* Remote top-left button.
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
//% color="#B4009E" weight=98 icon="\uf192"
|
||||
//% groups='["Touch Sensor", "Gyro Sensor", "Color Sensor", "Ultrasonic Sensor", "Infrared Sensor", "Remote", "Brick"]'
|
||||
//% groups='["Touch Sensor", "Color Sensor", "Ultrasonic Sensor", "Infrared Sensor", "Remote", "Brick", "Gyro Sensor"]'
|
||||
namespace input {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user