Explain what pressed events do (#469)

This commit is contained in:
HelenFoster 2017-07-28 18:05:53 +01:00 committed by Peli de Halleux
parent 1ac227fb7f
commit 39071b5626
5 changed files with 12 additions and 8 deletions

View File

@ -5,6 +5,9 @@ This handler works when button `A` or `B` is pressed, or `A` and `B` together.
When you are using this function in a web browser, click the buttons on the screen instead of the ones
on the @boardname@.
* For button `A` or `B`: This handler works when the button is pushed down and released within 1 second.
* For `A` and `B` together: This handler works when `A` and `B` are both pushed down, then one of them is released within 1.5 seconds of pushing down the second button.
```sig
input.onButtonPressed(Button.A, () => {})
```

View File

@ -2,8 +2,9 @@
Start an [event handler](/reference/event-handler) (part of the
program that will run when something happens, like when a button is
pressed). This handler works when you press pin `0`, `1`, or `2`
together with `GND`. When you are using this function in a web
pressed). This handler works when you touch pin `0`, `1`, or `2`
together with `GND`, and release it within 1 second.
When you are using this function in a web
browser, click the pins on the screen instead of the ones on the
@boardname@.

View File

@ -110,7 +110,7 @@
"input.lightLevel": "Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.",
"input.magneticForce": "Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed": "Do something when a button (``A``, ``B`` or both ``A+B``) is pressed",
"input.onButtonPressed": "Do something when a button (A, B or both A+B) is pushed down and released again.",
"input.onButtonPressed|param|body": "code to run when event is raised",
"input.onButtonPressed|param|button": "the button that needs to be pressed",
"input.onGesture": "Do something when when a gesture is done (like shaking the micro:bit).",
@ -120,7 +120,7 @@
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp": "Attaches code to run when the logo is oriented upwards and the board is vertical.",
"input.onLogoUp|param|body": "TODO",
"input.onPinPressed": "Do something when a pin is pressed.",
"input.onPinPressed": "Do something when a pin is touched and released again (while also touching the GND pin).",
"input.onPinPressed|param|body": "the code to run when the pin is pressed",
"input.onPinPressed|param|name": "the pin that needs to be pressed, eg: TouchPin.P0",
"input.onPinReleased": "Do something when a pin is released.",

View File

@ -150,7 +150,7 @@ enum class MesDpadButtonInfo {
//% color=#B4009E weight=99 icon="\uf192"
namespace input {
/**
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
* Do something when a button (A, B or both A+B) is pushed down and released again.
* @param button the button that needs to be pressed
* @param body code to run when event is raised
*/
@ -180,7 +180,7 @@ namespace input {
}
/**
* Do something when a pin is pressed.
* Do something when a pin is touched and released again (while also touching the GND pin).
* @param name the pin that needs to be pressed, eg: TouchPin.P0
* @param body the code to run when the pin is pressed
*/

View File

@ -216,7 +216,7 @@ declare namespace basic {
declare namespace input {
/**
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
* Do something when a button (A, B or both A+B) is pushed down and released again.
* @param button the button that needs to be pressed
* @param body code to run when event is raised
*/
@ -237,7 +237,7 @@ declare namespace input {
function onGesture(gesture: Gesture, body: () => void): void;
/**
* Do something when a pin is pressed.
* Do something when a pin is touched and released again (while also touching the GND pin).
* @param name the pin that needs to be pressed, eg: TouchPin.P0
* @param body the code to run when the pin is pressed
*/