pxt-calliope/docs/device/crocodile-clips.md

24 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# crocodile clips
2016-04-16 00:02:26 +02:00
The large holes at the bottom of the board are designed to attach alligator/crocodile clips.
Register an event that will execute whenever the user attaches one side of the crocodile clip to the `GND` pin, then connects and disconnects the unattached side of the crocodile clip to pin `0`, `1`, or `2`.
2016-03-26 00:47:20 +01:00
### Example: on pin pressed with random numbers
This example displays a random number every time the crocodile clip holds `GND` then connects and disconnects the `P0` pin. Each time the crocodile clip is firmly connected and disconnected from pin `P0`, the micro:bit will return a random Number between 0 and the parameter limit
2016-09-01 14:08:27 +02:00
```blocks
input.onPinPressed(TouchPin.P0, () => {
basic.showNumber(Math.random(10))
})
```
2016-03-26 00:47:20 +01:00
### Connecting Crocodile Clips
2016-09-01 14:08:27 +02:00
![](/static/mb/crocodile-clips-2.jpg)
2016-03-26 00:47:20 +01:00
### See also
2016-04-13 17:27:45 +02:00
[micro:bit 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)
2016-03-26 00:47:20 +01:00