Skip to content

Commit 60d7463

Browse files
docs: Backport V2 changes to pin IO API and tutorial to V1.
1 parent c5dd6f8 commit 60d7463

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

docs/pin.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ in ``read_digital`` mode with the given pull mode.
213213
for buttons A and B to work.
214214

215215
For more info see the `edge connector data sheet
216-
<http://tech.microbit.org/hardware/edgeconnector_ds>`_.
216+
<http://tech.microbit.org/hardware/edgeconnector>`_.
217217

218218
.. note::
219-
GPIO pins are also used for the display. 6 of these are routed to the
220-
edge connector at 3, 4, 6, 7, 9. and 10. If you want to use these pins
221-
for another purpose, you may need to turn the `display off
219+
GPIO pins are also used for the display, as described in the table above.
220+
If you want to use these pins for another purpose, you may need to turn
221+
the `display off
222222
<https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.off>`_.
223223

224224
For more info see the `edge connector data sheet
225-
<http://tech.microbit.org/hardware/edgeconnector_ds>`_.
225+
<http://tech.microbit.org/hardware/edgeconnector>`_.

docs/tutorials/io.rst

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
Input/Output
2-
------------
1+
Input/Output Pins
2+
-----------------
33

44
There are strips of metal along the bottom edge of the BBC micro:bit that make
55
it look as if the device has teeth. These are the input/output pins (or I/O pins
66
for short).
77

88
.. image:: blue-microbit.png
9+
:width: 300px
10+
:align: center
911

1012
Some of the pins are bigger than others so it's possible to attach crocodile
1113
clips to them. These are the ones labelled 0, 1, 2, 3V and GND (computers
1214
always start counting from zero). If you attach an edge connector board to the
1315
device it's possible to plug in wires connected to the other (smaller) pins.
1416

15-
Each pin on the BBC micro:bit is represented by an *object* called ``pinN``
16-
where ``N`` is the pin number. So, for example, to do things with the pin
17-
labelled with a 0 (zero), use the object called ``pin0``.
17+
In MicroPython, each pin on the BBC micro:bit is represented by an *object*
18+
called ``pinN``, where ``N`` is the number pf the pin.
1819

19-
Simple!
20+
For example, to use the pin labelled 0 (zero), you can use the object called
21+
``pin0`` in your script.
2022

2123
These objects have various *methods* associated with them depending upon what
22-
the specific pin is capable of.
24+
the specific pin is capable of eg. read, write or touch.
2325

2426
Ticklish Python
2527
+++++++++++++++
2628

2729
The simplest example of input via the pins is a check to see if they are
28-
touched. So, you can tickle your device to make it laugh like this::
30+
touched. So, you can tickle your micro:bit to make it laugh like this::
2931

3032
from microbit import *
3133

@@ -35,7 +37,7 @@ touched. So, you can tickle your device to make it laugh like this::
3537
else:
3638
display.show(Image.SAD)
3739

38-
With one hand, hold your device by the GND pin. Then, with your other hand,
40+
With one hand, hold your micro:bit by the GND pin. Then, with your other hand,
3941
touch (or tickle) the 0 (zero) pin. You should see the display change from
4042
grumpy to happy!
4143

@@ -45,8 +47,8 @@ when you plug in circuits and other devices via the pins.
4547
Bleeps and Bloops
4648
+++++++++++++++++
4749

48-
The simplest thing we can attach to the device is a Piezo buzzer. There are two
49-
types of piezo buzzers. The simplest type to use are called active buzzers.
50+
The simplest thing we can attach to the micro:bit is a Piezo buzzer. There are
51+
two types of piezo buzzers. The simplest type to use are called active buzzers.
5052
Active buzzers contain an oscillator that produces a tone at a predetermined
5153
pitch when a current is passed through them. Passive buzzers require an
5254
oscillating current to be passed through them to produce a tone at the frequency
@@ -55,11 +57,17 @@ one tone, while passive buzzers are slightly more complicated to use but can
5557
produce a variety of tones.
5658

5759
.. image:: piezo_buzzer.jpg
60+
:width: 250px
61+
:align: center
62+
:alt: piezo buzzer
5863

5964
We're going to use an active piezo buzzer for output. To attach one to your BBC
6065
micro:bit you should attach crocodile clips to pin 0 and GND (as shown below).
6166

6267
.. image:: pin0-gnd.png
68+
:width: 250px
69+
:align: center
70+
:alt: piezo connected to pin0 and GND
6371

6472
The wire from pin 0 should be attached to the positive connector on the buzzer
6573
and the wire from GND to the negative connector.

docs/tutorials/piezo_buzzer.jpg

-114 KB
Loading

docs/tutorials/pin0-gnd.png

25.9 KB
Loading

0 commit comments

Comments
 (0)