hiding the was pressed block (#401)

This commit is contained in:
Peli de Halleux
2018-04-03 04:10:35 -07:00
committed by GitHub
parent 6c626f9c98
commit c0413aa192
10 changed files with 14 additions and 12 deletions

View File

@ -20,8 +20,8 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
});
brick.buttonEnter.pauseUntil(ButtonEvent.Bumped);
brick.buttonEnter.isPressed()
brick.buttonEnter.wasPressed()
brick.setStatusLight(StatusLight.Red);
brick.buttonEnter.wasPressed()
```
## Other

View File

@ -14,7 +14,7 @@ The fact that a button was pressed earlier is remembered. Once **was pressed** i
Your @boardname@ has touch sensors that work like buttons. Instead of saying `enter` or `left` as the source button, use a touch sensor block with a sensor name like `touch 1`.
```block
```typescript
if (sensors.touch1.wasPressed()) {
console.log("Hey, I was pressed.");
}
@ -32,7 +32,7 @@ Read about [touch sensors](/reference/sensors/touch-sensor) and using them as to
Set the brick light to green if the `right` button was pressed before the `left` button. If not, the brick light is turned off when the `left` button is pressed.
```blocks
```typescript
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function() {
if (brick.buttonRight.wasPressed()) {
brick.setStatusLight(StatusLight.Green)
@ -45,6 +45,5 @@ brick.buttonLeft.onEvent(ButtonEvent.Bumped, function() {
## See also
[is pressed](/reference/brick/button/is-pressed),
[on event](/reference/brick/button/on-event)
[on event](/reference/brick/button/on-event),
[Touch sensors](/reference/sensors/touch-sensor)

View File

@ -17,8 +17,8 @@ sensors.color(ColorSensorColor.Blue)
```cards
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {})
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
sensors.touch1.wasPressed()
sensors.touch1.isPressed()
sensors.touch1.wasPressed()
```
## Gyro