fixing a bunch of snippets

This commit is contained in:
Peli de Halleux
2018-01-18 16:43:16 -08:00
parent a60427e2cf
commit db4ed6daf3
20 changed files with 93 additions and 75 deletions

View File

@ -3,9 +3,9 @@
```blocks
loops.forever(function () {
if (sensors.color1.ambientLight() > 20) {
brick.setStatusLight(LightsPattern.Green)
brick.setLight(BrickLight.Green)
} else {
brick.setStatusLight(LightsPattern.Orange)
brick.setLight(BrickLight.Orange)
}
})
```

View File

@ -3,9 +3,9 @@
```blocks
loops.forever(function () {
if (sensors.color1.color() == ColorSensorColor.Green) {
brick.setStatusLight(LightsPattern.Green)
brick.setLight(BrickLight.Green)
} else {
brick.setStatusLight(LightsPattern.Orange)
brick.setLight(BrickLight.Orange)
}
})
```

View File

@ -3,9 +3,9 @@
```blocks
loops.forever(function () {
if (sensors.color1.reflectedLight() > 20) {
brick.setStatusLight(LightsPattern.Green)
brick.setLight(BrickLight.Green)
} else {
brick.setStatusLight(LightsPattern.Orange)
brick.setLight(BrickLight.Orange)
}
})
```

View File

@ -1,11 +1,11 @@
# Touch Sensor
```cards
sensors.touchSensor1.onEvent(TouchSensorEvent.Pressed, function () {
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
brick.showImage(images.expressionsBigSmile)
})
sensors.touchSensor1.isPressed();
sensors.touchSensor1.wasPressed();
sensors.touch1.isPressed();
sensors.touch1.wasPressed();
```
## See Also

View File

@ -2,10 +2,10 @@
```blocks
loops.forever(function () {
if (sensors.touchSensor1.isPressed()) {
brick.setStatusLight(LightsPattern.Green)
if (sensors.touch1.isPressed()) {
brick.setLight(BrickLight.Green)
} else {
brick.setStatusLight(LightsPattern.Orange)
brick.setLight(BrickLight.Orange)
}
})
```

View File

@ -1,7 +1,7 @@
# On Event
```sig
sensors.touchSensor1.onEvent(TouchSensorEvent.Released, function () { })
sensors.touch1.onEvent(TouchSensorEvent.Released, function () { })
```
# Parameters
@ -10,7 +10,7 @@ sensors.touchSensor1.onEvent(TouchSensorEvent.Released, function () { })
```blocks
sensors.touchSensor1.onEvent(TouchSensorEvent.Released, function () {
sensors.touch1.onEvent(TouchSensorEvent.Released, function () {
brick.showImage(images.expressionsSick)
})
```

View File

@ -2,10 +2,10 @@
```blocks
loops.forever(function () {
if (sensors.touchSensor1.wasPressed()) {
brick.setStatusLight(LightsPattern.Green)
if (sensors.touch1.wasPressed()) {
brick.setLight(BrickLight.Green)
} else {
brick.setStatusLight(LightsPattern.Orange)
brick.setLight(BrickLight.Orange)
}
})
```