Buttons rename (#287)
* renaming up/down/click to released/pressed/bump * missing images * fixing signature issue * updated strings * white lego logo
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
Run some code when a button is clicked, pressed down, or released.
|
||||
|
||||
```sig
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
|
||||
});
|
||||
```
|
||||
@ -15,7 +15,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
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
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.setLight(BrickLight.Orange);
|
||||
});
|
||||
```
|
||||
@ -38,13 +38,13 @@ Check for event on the ENTER button. Put a message on the screen when the button
|
||||
|
||||
```blocks
|
||||
brick.showString("ENTER is: UP", 1);
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Up, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Released, function () {
|
||||
brick.showString("ENTER is: UP ", 1);
|
||||
});
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Down, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.showString("ENTER is: DOWN ", 1);
|
||||
});
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
brick.showString("ENTER was: CLICKED", 1);
|
||||
});
|
||||
```
|
||||
|
@ -3,7 +3,7 @@
|
||||
Causes your program to wait until an event at a button happens.
|
||||
|
||||
```sig
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Click);
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Bumped);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@ -23,7 +23,7 @@ brick.showString("We're going to wait", 1);
|
||||
brick.showString("for you to press and", 2);
|
||||
brick.showString("release the UP button", 3);
|
||||
waitTime = control.millis();
|
||||
brick.buttonUp.pauseUntil(ButtonEvent.Click);
|
||||
brick.buttonUp.pauseUntil(ButtonEvent.Bumped);
|
||||
brick.clearScreen();
|
||||
if (control.millis() - waitTime > 5000) {
|
||||
brick.showString("Ok, that took awhile!", 1)
|
||||
|
@ -33,7 +33,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
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Click, function() {
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function() {
|
||||
if (brick.buttonRight.wasPressed()) {
|
||||
brick.setLight(BrickLight.Green)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user