V4updates (#185)
* update 32KB * reorder buttonEvents to have clicked as default * update event block documentation file path * remove on pin released documentation * update shims, enums and package-lock
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# On Button Pressed
|
||||
# On Button Event
|
||||
|
||||
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 button `A` or `B` is pressed, or `A` and `B` together.
|
@ -1,4 +1,4 @@
|
||||
# On Pin Pressed
|
||||
# On Pin Event
|
||||
|
||||
Start an [event handler](/reference/event-handler) (part of the
|
||||
program that will run when something happens, like when a button is
|
@ -1,48 +0,0 @@
|
||||
# On Pin Released
|
||||
|
||||
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 release pin `0`, `1`, or `2`
|
||||
together with `GND`. When you are using this function in a web
|
||||
browser, click and release the pins on the screen instead of the ones on the
|
||||
@boardname@.
|
||||
|
||||
If you hold the `GND` pin with one hand and touch pin `0`, `1`, or `2`
|
||||
with the other, a very small (safe) amount of electricity will flow
|
||||
through your body and back into the @boardname@. This is called
|
||||
**completing a circuit**. It's like you're a big wire!
|
||||
|
||||
```sig
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Up, () => {
|
||||
})
|
||||
```
|
||||
|
||||
## ~hint
|
||||
|
||||
This function works best when the @boardname@ is using batteries for power,
|
||||
instead of the USB cable.
|
||||
|
||||
## ~
|
||||
|
||||
## Parameters
|
||||
|
||||
* ``name`` means the pin that is being released, either `P0`, `P1`, or `P2`
|
||||
|
||||
## Example: pin pressed counter
|
||||
|
||||
This program counts how many times you release the `P0` pin.
|
||||
Every time you release the pin, the program shows the number of times on the screen.
|
||||
|
||||
```blocks
|
||||
let count = 0
|
||||
basic.showNumber(count, 100)
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Up, () => {
|
||||
count = count + 1
|
||||
basic.showNumber(count, 100)
|
||||
})
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[@boardname@ pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
|
||||
|
Reference in New Issue
Block a user