From 8841c4763899c26592d805d7dc8c72e437ce6efd Mon Sep 17 00:00:00 2001 From: Ron Hale-Evans Date: Fri, 10 Jun 2016 14:44:49 -0700 Subject: [PATCH] Rewrote in simple language. Fixed some typos. --- docs/reference/input/on-pin-pressed.md | 20 +++++++++++++++++--- docs/reference/input/pin-is-pressed.md | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/reference/input/on-pin-pressed.md b/docs/reference/input/on-pin-pressed.md index a4ed27be..47cceeb4 100644 --- a/docs/reference/input/on-pin-pressed.md +++ b/docs/reference/input/on-pin-pressed.md @@ -1,17 +1,31 @@ # On Pin Pressed -Register an [event handler](/reference/event-handler) that will execute whenever the user holds the `GND` pin with one hand, and presses pin `0`, `1`, or `2` with the other hand, thus completing a circuit; when you run a script with this function in a web browser, click pins 0 , 1, or 2 on the simulator. +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 browser, click the pins on the screen instead of the ones +on the BBC micro:bit. -*Note* that this function works best when the BBC micro:bit is powered by AAA battery. +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 micro:bit. This is called **completing a circuit**. It's like you're a big wire! ```sig input.onPinPressed(TouchPin.P0, () => { }) ``` +## ~hint + +This function works best when the BBC micro:bit is using batteries for power, +instead of the USB cable. + +## ~ + ### Example: pin pressed counter -This example counts how many times the P0 pin is pressed. Each time the pin is pressed, the global count variable is increased by 1 and displayed on the screen. +This program counts how many times you press the `P0` pin. +Every time you press the pin, the program shows the number of times on the screen. ```blocks let count = 0 diff --git a/docs/reference/input/pin-is-pressed.md b/docs/reference/input/pin-is-pressed.md index 8139f5ed..a1f4f528 100644 --- a/docs/reference/input/pin-is-pressed.md +++ b/docs/reference/input/pin-is-pressed.md @@ -12,7 +12,7 @@ input.pinIsPressed(TouchPin.P0); ## ~hint -This function works best when the BBC:microbit is using batteries for power, +This function works best when the BBC micro:bit is using batteries for power, instead of the USB cable. ## ~