bump version to 0.1.13 (#407)

* bump version

* Light Condition -> Light

* roll back 0.1.11
This commit is contained in:
Peli de Halleux 2018-04-03 12:03:15 -07:00 committed by GitHub
parent b618bfec59
commit ec1ceea138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 41 additions and 41 deletions

View File

@ -100,8 +100,8 @@
* [Color](/reference/sensors/color-sensor) * [Color](/reference/sensors/color-sensor)
* [on color detected](/reference/sensors/color-sensor/on-color-detected) * [on color detected](/reference/sensors/color-sensor/on-color-detected)
* [pause until color detected](/reference/sensors/color-sensor/pause-until-color-detected) * [pause until color detected](/reference/sensors/color-sensor/pause-until-color-detected)
* [on-light-condition-detected](/reference/sensors/color-sensor/on-light-condition-detected) * [on light detected](/reference/sensors/color-sensor/on-light-detected)
* [pause until light condition detected](/reference/sensors/color-sensor/pause-until-light-condition-detected) * [pause until light condition detected](/reference/sensors/color-sensor/pause-until-light-detected)
* [color](/reference/sensors/color-sensor/color) * [color](/reference/sensors/color-sensor/color)
* [light](/reference/sensors/color-sensor/ambient-light) * [light](/reference/sensors/color-sensor/ambient-light)
* [Music](/reference/music) * [Music](/reference/music)

View File

@ -1,7 +1,7 @@
# Light the way Activity 1 # Light the way Activity 1
```blocks ```blocks
sensors.color3.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Dark, function () { sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function () {
brick.showImage(images.objectsLightOn) brick.showImage(images.objectsLightOn)
pause(5000) pause(5000)
brick.clearScreen() brick.clearScreen()

View File

@ -1,10 +1,10 @@
# Light the way Activity 2 # Light the way Activity 2
```blocks ```blocks
sensors.color3.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Bright, function () { sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Bright, function () {
brick.clearScreen() brick.clearScreen()
}) })
sensors.color3.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Dark, function () { sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function () {
brick.showImage(images.objectsLightOn) brick.showImage(images.objectsLightOn)
}) })
``` ```

View File

@ -1,10 +1,10 @@
# Light the way Activity 3 # Light the way Activity 3
```blocks ```blocks
sensors.color3.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Bright, function () { sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Bright, function () {
brick.clearScreen() brick.clearScreen()
}) })
sensors.color3.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Dark, function () { sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function () {
brick.showImage(images.objectsLightOn) brick.showImage(images.objectsLightOn)
}) })
sensors.touch1.onEvent(ButtonEvent.Pressed, function () { sensors.touch1.onEvent(ButtonEvent.Pressed, function () {

View File

@ -213,12 +213,12 @@ music.playSoundEffect(sounds.systemGeneralAlert)
} }
while (true) { while (true) {
while (true) { while (true) {
sensors.color3.pauseUntilLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Bright) sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(10) motors.largeB.run(10)
motors.largeC.run(-10) motors.largeC.run(-10)
} }
while (true) { while (true) {
sensors.color3.pauseUntilLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Bright) sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeA.run(-10) motors.largeA.run(-10)
motors.largeA.run(10) motors.largeA.run(10)
} }
@ -236,12 +236,12 @@ You will need to constantly debug your program in order to make your robot trave
```blocks ```blocks
while (true) { while (true) {
while (true) { while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, LightCondition.Bright) sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(10) motors.largeB.run(10)
motors.largeC.run(-10) motors.largeC.run(-10)
} }
while (true) { while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, LightCondition.Bright) sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(-10) motors.largeB.run(-10)
motors.largeC.run(10) motors.largeC.run(10)
} }

View File

@ -4,8 +4,8 @@
```cards ```cards
sensors.color1.onColorDetected(ColorSensorColor.Blue, function () {}) sensors.color1.onColorDetected(ColorSensorColor.Blue, function () {})
sensors.color1.onLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark, function () {}) sensors.color1.onLightDetected(LightIntensityMode.Reflected, Light.Dark, function () {})
sensors.color1.pauseUntilLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark) sensors.color1.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Dark)
sensors.color1.pauseUntilColorDetected(ColorSensorColor.Blue) sensors.color1.pauseUntilColorDetected(ColorSensorColor.Blue)
sensors.color1.color(); sensors.color1.color();
sensors.color1.light(LightIntensityMode.Ambient) sensors.color1.light(LightIntensityMode.Ambient)

View File

@ -37,7 +37,7 @@ const enum ColorSensorColor {
Brown Brown
} }
enum LightCondition { enum Light {
//% block="dark" //% block="dark"
Dark = sensors.ThresholdState.Low, Dark = sensors.ThresholdState.Low,
//% block="bright" //% block="bright"
@ -184,7 +184,7 @@ namespace sensors {
* @param condition the light condition * @param condition the light condition
* @param handler the code to run when detected * @param handler the code to run when detected
*/ */
//% help=sensors/color-sensor/on-light-condition-detected //% help=sensors/color-sensor/on-light-detected
//% block="on **color sensor** %this|detected %mode|%condition" //% block="on **color sensor** %this|detected %mode|%condition"
//% blockId=colorOnLightDetected //% blockId=colorOnLightDetected
//% parts="colorsensor" //% parts="colorsensor"
@ -192,7 +192,7 @@ namespace sensors {
//% this.fieldEditor="ports" //% this.fieldEditor="ports"
//% weight=89 blockGap=12 //% weight=89 blockGap=12
//% group="Color Sensor" //% group="Color Sensor"
onLightConditionDetected(mode: LightIntensityMode, condition: LightCondition, handler: () => void) { onLightDetected(mode: LightIntensityMode, condition: Light, handler: () => void) {
this.setMode(<ColorSensorMode><number>mode) this.setMode(<ColorSensorMode><number>mode)
control.onEvent(this._id, <number>condition, handler); control.onEvent(this._id, <number>condition, handler);
} }
@ -201,15 +201,15 @@ namespace sensors {
* Wait for the given color to be detected * Wait for the given color to be detected
* @param color the color to detect * @param color the color to detect
*/ */
//% help=sensors/color-sensor/pause-until-light-condition-detected //% help=sensors/color-sensor/pause-until-light-detected
//% block="pause until **color sensor** %this|detected %mode|%condition" //% block="pause until **color sensor** %this|detected %mode|%condition"
//% blockId=colorPauseUntilLightConditionDetected //% blockId=colorPauseUntilLightDetected
//% parts="colorsensor" //% parts="colorsensor"
//% blockNamespace=sensors //% blockNamespace=sensors
//% this.fieldEditor="ports" //% this.fieldEditor="ports"
//% weight=88 blockGap=8 //% weight=88 blockGap=8
//% group="Color Sensor" //% group="Color Sensor"
pauseUntilLightConditionDetected(mode: LightIntensityMode, condition: LightCondition) { pauseUntilLightDetected(mode: LightIntensityMode, condition: Light) {
this.setMode(<ColorSensorMode><number>mode) this.setMode(<ColorSensorMode><number>mode)
if (this.thresholdDetector.state != <number>condition) if (this.thresholdDetector.state != <number>condition)
control.waitForEvent(this._id, <number>condition) control.waitForEvent(this._id, <number>condition)
@ -252,8 +252,8 @@ namespace sensors {
//% value.min=0 value.max=100 //% value.min=0 value.max=100
//% this.fieldEditor="ports" //% this.fieldEditor="ports"
//% help=sensors/color-sensor/set-threshold //% help=sensors/color-sensor/set-threshold
setThreshold(condition: LightCondition, value: number) { setThreshold(condition: Light, value: number) {
if (condition == LightCondition.Dark) if (condition == Light.Dark)
this.thresholdDetector.setLowThreshold(value) this.thresholdDetector.setLowThreshold(value)
else else
this.thresholdDetector.setHighThreshold(value); this.thresholdDetector.setHighThreshold(value);
@ -267,8 +267,8 @@ namespace sensors {
//% group="Threshold" blockGap=8 weight=89 //% group="Threshold" blockGap=8 weight=89
//% this.fieldEditor="ports" //% this.fieldEditor="ports"
//% help=sensors/color-sensor/threshold //% help=sensors/color-sensor/threshold
threshold(condition: LightCondition): number { threshold(condition: Light): number {
return this.thresholdDetector.threshold(<ThresholdState><number>LightCondition.Dark); return this.thresholdDetector.threshold(<ThresholdState><number>Light.Dark);
} }
/** /**

View File

@ -2,8 +2,8 @@
```cards ```cards
sensors.color1.onColorDetected(ColorSensorColor.Blue, function () {}) sensors.color1.onColorDetected(ColorSensorColor.Blue, function () {})
sensors.color1.onLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark, function () {}) sensors.color1.onLightDetected(LightIntensityMode.Reflected, Light.Dark, function () {})
sensors.color1.pauseUntilLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark) sensors.color1.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Dark)
sensors.color1.pauseUntilColorDetected(ColorSensorColor.Blue) sensors.color1.pauseUntilColorDetected(ColorSensorColor.Blue)
sensors.color1.color(); sensors.color1.color();
sensors.color1.light(LightIntensityMode.Ambient) sensors.color1.light(LightIntensityMode.Ambient)
@ -13,7 +13,7 @@ sensors.color1.light(LightIntensityMode.Ambient)
[on color detected](/reference/sensors/color-sensor/on-color-detected), [on color detected](/reference/sensors/color-sensor/on-color-detected),
[pause until color detected](/reference/sensors/color-sensor/pause-until-color-detected), [pause until color detected](/reference/sensors/color-sensor/pause-until-color-detected),
[on light condition detected](/reference/sensors/color-sensor/on-light-condition-detected), [on light detected](/reference/sensors/color-sensor/on-light-detected),
[pause until light condition detected](/reference/sensors/color-sensor/pause-until-light-condition-detected), [pause until light detected](/reference/sensors/color-sensor/pause-until-light-detected),
[color](/reference/sensors/color-sensor/color), [color](/reference/sensors/color-sensor/color),
[light](/reference/sensors/color-sensor/ambient-light) [light](/reference/sensors/color-sensor/ambient-light)

View File

@ -3,7 +3,7 @@
Run some code when the amount of light dectected changes. Run some code when the amount of light dectected changes.
```sig ```sig
sensors.color1.onLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark, function () { sensors.color1.onLightDetected(LightIntensityMode.Reflected, Light.Dark, function () {
}) })
``` ```
@ -21,7 +21,7 @@ You can check for a change in either _ambient_ or _reflected_ light and run some
Show a message on the screen when the ambient light goes dark. Show a message on the screen when the ambient light goes dark.
```blocks ```blocks
sensors.color1.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Dark, function() { sensors.color1.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function() {
brick.clearScreen(); brick.clearScreen();
brick.showString("It just got dark", 1) brick.showString("It just got dark", 1)
brick.showString("Can you see me?", 2) brick.showString("Can you see me?", 2)

View File

@ -3,7 +3,7 @@
Wait until a particular light condition is detected. Wait until a particular light condition is detected.
```sig ```sig
sensors.color1.pauseUntilLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark) sensors.color1.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Dark)
``` ```
You can wait for a change in either _ambient_ or _reflected_ light. This event happens when the sensor detects light going to ``dark`` or to ``bright``. You choose what condition you will wait for. You can wait for a change in either _ambient_ or _reflected_ light. This event happens when the sensor detects light going to ``dark`` or to ``bright``. You choose what condition you will wait for.
@ -19,11 +19,11 @@ Wait for the ambient light to go dark, then show an expression on the screen.
```blocks ```blocks
brick.showString("Waiting for dark", 1) brick.showString("Waiting for dark", 1)
sensors.color1.pauseUntilLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark) sensors.color1.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Dark)
brick.clearScreen() brick.clearScreen()
brick.showImage(images.expressionsSick) brick.showImage(images.expressionsSick)
``` ```
## See also ## See also
[on light condition detected](/reference/sensors/color-sensor/on-light-condition-detected) [on light detected](/reference/sensors/color-sensor/on-light-detected)

View File

@ -3,7 +3,7 @@
Set the threshold value for dark or bright light. Set the threshold value for dark or bright light.
```sig ```sig
sensors.color1.setThreshold(LightCondition.Dark, 0) sensors.color1.setThreshold(Light.Dark, 0)
``` ```
Light intensity is measured from `0` (very dark) to `100` (very bright). You can decide what dark and bright mean for your purposes and set a _threshold_ for them. A threshold is a boundary or a limit. If you want a light intensity of `20` mean that it's dark, then you set the sensor threshold for ``dark`` to `20`. Also, if you think that `75` is bright, then you can set the threshold for ``bright`` to that. Light intensity is measured from `0` (very dark) to `100` (very bright). You can decide what dark and bright mean for your purposes and set a _threshold_ for them. A threshold is a boundary or a limit. If you want a light intensity of `20` mean that it's dark, then you set the sensor threshold for ``dark`` to `20`. Also, if you think that `75` is bright, then you can set the threshold for ``bright`` to that.
@ -11,8 +11,8 @@ Light intensity is measured from `0` (very dark) to `100` (very bright). You can
After setting a threshold, any event for that light condition won't happen until the amount of light reaches your threshold value: After setting a threshold, any event for that light condition won't happen until the amount of light reaches your threshold value:
```block ```block
sensors.color1.setThreshold(LightCondition.Dark, 20) sensors.color1.setThreshold(Light.Dark, 20)
sensors.color1.onLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark, function () { sensors.color1.onLightDetected(LightIntensityMode.Reflected, Light.Dark, function () {
brick.showMood(moods.sleeping) brick.showMood(moods.sleeping)
}) })
``` ```
@ -27,8 +27,8 @@ sensors.color1.onLightConditionDetected(LightIntensityMode.Reflected, LightCondi
Make a daylight alarm. When the ambient light reaches `70` flash the status light and play a sound. Make a daylight alarm. When the ambient light reaches `70` flash the status light and play a sound.
```blocks ```blocks
sensors.color3.setThreshold(LightCondition.Bright, 70) sensors.color3.setThreshold(Light.Bright, 70)
sensors.color3.onLightConditionDetected(LightIntensityMode.Ambient, LightCondition.Bright, function () { sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Bright, function () {
brick.setStatusLight(StatusLight.GreenFlash) brick.setStatusLight(StatusLight.GreenFlash)
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
music.playSoundEffectUntilDone(sounds.mechanicalBackingAlert) music.playSoundEffectUntilDone(sounds.mechanicalBackingAlert)

View File

@ -3,7 +3,7 @@
Get the threshold value for dark or bright light. Get the threshold value for dark or bright light.
```sig ```sig
sensors.color1.threshold(LightCondition.Dark) sensors.color1.threshold(Light.Dark)
``` ```
Light intensity is measured from `0` (very dark) to `100` (very bright). A _threshold_ sets what dark and bright mean for your purposes. A threshold is a boundary or a limit. If a light intensity of `20` means that it's dark, then the sensor threshold for ``dark`` is `20`. Also, if `75` means bright, then the threshold value for ``bright`` is `75`. Light intensity is measured from `0` (very dark) to `100` (very bright). A _threshold_ sets what dark and bright mean for your purposes. A threshold is a boundary or a limit. If a light intensity of `20` means that it's dark, then the sensor threshold for ``dark`` is `20`. Also, if `75` means bright, then the threshold value for ``bright`` is `75`.
@ -17,8 +17,8 @@ Light intensity is measured from `0` (very dark) to `100` (very bright). A _thre
Find out what light level is set as the ``dark`` threshold when a dark light event happens. Find out what light level is set as the ``dark`` threshold when a dark light event happens.
```blocks ```blocks
sensors.color3.onLightConditionDetected(LightIntensityMode.Reflected, LightCondition.Dark, function () { sensors.color3.onLightDetected(LightIntensityMode.Reflected, Light.Dark, function () {
brick.showValue("DarknessThresholdValue", sensors.color3.threshold(LightCondition.Dark), 1) brick.showValue("DarknessThresholdValue", sensors.color3.threshold(Light.Dark), 1)
}) })
``` ```

View File

@ -279,7 +279,7 @@ namespace sensors {
//% group="Threshold" blockGap=8 weight=49 //% group="Threshold" blockGap=8 weight=49
//% this.fieldEditor="ports" //% this.fieldEditor="ports"
proximityThreshold(condition: InfraredSensorEvent): number { proximityThreshold(condition: InfraredSensorEvent): number {
return this._proximityThreshold.threshold(<ThresholdState><number>LightCondition.Dark); return this._proximityThreshold.threshold(<ThresholdState><number>Light.Dark);
} }
// TODO // TODO