Added missing parameters sections
This commit is contained in:
parent
f56e9369dd
commit
6a7f65894c
@ -2,14 +2,18 @@
|
|||||||
|
|
||||||
Start an [event handler](/reference/event-handler) (part of the
|
Start an [event handler](/reference/event-handler) (part of the
|
||||||
program that will run when something happens) This handler works when
|
program that will run when something happens) This handler works when
|
||||||
you do a **gesture** (like shake, tilt, or drop the micro:bit).
|
you do a **gesture** (like shaking the micro:bit).
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
input.onGesture(Gesture.Shake,() => {
|
input.onGesture(Gesture.Shake,() => {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example: random number
|
### Parameters
|
||||||
|
|
||||||
|
* ``gesture`` means the way you hold or move the micro:bit. This can be `shake`, `logo up`, `logo down`, `screen up`, `screen down`, `tilt left`, `tilt right`, `free fall`, `3g`, or `6g`.
|
||||||
|
|
||||||
|
### Example: random number
|
||||||
|
|
||||||
This program shows a number from `0` to `9` when you shake the micro:bit.
|
This program shows a number from `0` to `9` when you shake the micro:bit.
|
||||||
|
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
# On Pin Pressed
|
# On Pin Pressed
|
||||||
|
|
||||||
Start an [event handler](/reference/event-handler) (part of the program
|
Start an [event handler](/reference/event-handler) (part of the
|
||||||
that will run when something happens, like when a button is pressed).
|
program that will run when something happens, like when a button is
|
||||||
This handler works when you press pin `0`, `1`, or `2` together with `GND`.
|
pressed). This handler works when you press pin `0`, `1`, or `2`
|
||||||
When you are using this function in a web browser, click the pins on the screen instead of the ones
|
together with `GND`. When you are using this function in a web
|
||||||
on the BBC micro:bit.
|
browser, click the pins on the screen instead of the ones on the BBC
|
||||||
|
micro:bit.
|
||||||
|
|
||||||
If you hold the `GND` pin with one hand and touch pin `0`, `1`, or `2` with the other,
|
If you hold the `GND` pin with one hand and touch pin `0`, `1`, or `2`
|
||||||
a very small (safe) amount of electricity will flow through your body and back into
|
with the other, a very small (safe) amount of electricity will flow
|
||||||
the micro:bit. This is called **completing a circuit**. It's like you're a big wire!
|
through your body and back into the micro:bit. This is called
|
||||||
|
**completing a circuit**. It's like you're a big wire!
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
input.onPinPressed(TouchPin.P0, () => {
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
@ -22,6 +24,10 @@ instead of the USB cable.
|
|||||||
|
|
||||||
## ~
|
## ~
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
* ``name`` means the pin that is being pressed, either `P0`, `P1`, or `P2`
|
||||||
|
|
||||||
### Example: pin pressed counter
|
### Example: pin pressed counter
|
||||||
|
|
||||||
This program counts how many times you press the `P0` pin.
|
This program counts how many times you press the `P0` pin.
|
||||||
|
Loading…
Reference in New Issue
Block a user