2.1.28, initiation update to PXT v5.28.24 (#54)
This commit is contained in:
committed by
Peli de Halleux
parent
38a964516e
commit
5c114a0c57
@@ -17,29 +17,35 @@ instead of the USB cable.
|
||||
|
||||
## ~
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* a [string](/reference/types/string) that holds the pin name (**P0**, **P1**, or **P2**)
|
||||
* a [string](/types/string) that holds the pin name (**P0**, **P1**, or **P2**)
|
||||
|
||||
### returns
|
||||
## returns
|
||||
|
||||
* a [boolean](/blocks/logic/boolean) that means whether the pin you say is pressed (`true` or `false`)
|
||||
|
||||
### Example
|
||||
## Pin presses in action
|
||||
|
||||
See how the @boardname@ detects a press at a pin or on something connected to a pin in this video:
|
||||
|
||||
https://www.youtube.com/watch?v=GEpZrvbsO7o
|
||||
|
||||
## Example
|
||||
|
||||
This program shows `1` if `P0` is pressed, and `0` if `P0` is not pressed:
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
if (input.pinIsPressed(TouchPin.P0)) {
|
||||
basic.showNumber(1, 150)
|
||||
basic.showNumber(1)
|
||||
} else {
|
||||
basic.showNumber(0, 150)
|
||||
basic.showNumber(0)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[@boardname@ pins](/device/pins), [on pin pressed](/reference/input/on-pin-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