@@ -8,17 +8,21 @@ for short).
88.. image :: blue-microbit.png
99 :width: 300px
1010 :align: center
11+ :alt: micro:bit with pins labelled
1112
1213Some of the pins are bigger than others so it's possible to attach crocodile
1314clips to them. These are the ones labelled 0, 1, 2, 3V and GND (computers
1415always start counting from zero). If you attach an edge connector board to the
1516device it's possible to plug in wires connected to the other (smaller) pins.
1617
18+ On the latest micro:bit **V2 ** the micro:bit logo can also be used as a touch
19+ input.
20+
1721In MicroPython, each pin on the BBC micro:bit is represented by an *object *
1822called ``pinN ``, where ``N `` is the number pf the pin.
1923
2024For example, to use the pin labelled 0 (zero), you can use the object called
21- ``pin0 `` in your script.
25+ ``pin0 `` in your script. The logo pin ** V2 ** uses `` pin_logo ``.
2226
2327These objects have various *methods * associated with them depending upon what
2428the specific pin is capable of eg. read, write or touch.
@@ -41,6 +45,20 @@ With one hand, hold your micro:bit by the GND pin. Then, with your other hand,
4145touch (or tickle) the 0 (zero) pin. You should see the display change from
4246grumpy to happy!
4347
48+ When you use the latest micro:bit **V2 ** you can also change the default
49+ behaviour of the pin, so that you don't have to touch GND at all.::
50+
51+ from microbit import *
52+ pin0.set_touch_mode(pin0.CAPACITIVE)
53+ while True:
54+ if pin0.is_touched():
55+ display.show(Image.HAPPY)
56+ else:
57+ display.show(Image.SAD)
58+
59+ The default for the edge connector pins is `resistive ` and the logo pin
60+ **V2 ** is `capacitive `.
61+
4462This is a form of very basic input measurement. However, the fun really starts
4563when you plug in circuits and other devices via the pins.
4664
0 commit comments