Skip to content

Commit 9b610ef

Browse files
docs: Include V2 features in tutorials (#709)
* docs: update-tutorials for V2 * docs: update images * remove pin functions reference link * reduce size of image * Update docs/pin.rst * Update docs/pin.rst * Update docs/tutorials/io.rst Co-authored-by: Carlos Pereira Atencio <[email protected]>
1 parent 858c3dd commit 9b610ef

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

docs/tutorials/blue-microbit.png

32 KB
Loading

docs/tutorials/happy.png

11.7 KB
Loading

docs/tutorials/io.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

1213
Some of the pins are bigger than others so it's possible to attach crocodile
1314
clips to them. These are the ones labelled 0, 1, 2, 3V and GND (computers
1415
always start counting from zero). If you attach an edge connector board to the
1516
device 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+
1721
In MicroPython, each pin on the BBC micro:bit is represented by an *object*
1822
called ``pinN``, where ``N`` is the number pf the pin.
1923

2024
For 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

2327
These objects have various *methods* associated with them depending upon what
2428
the 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,
4145
touch (or tickle) the 0 (zero) pin. You should see the display change from
4246
grumpy 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+
4462
This is a form of very basic input measurement. However, the fun really starts
4563
when you plug in circuits and other devices via the pins.
4664

docs/tutorials/music.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Music
33

44
MicroPython on the BBC micro:bit comes with a powerful music and sound module.
55
It's very easy to generate bleeps and bloops from the device by attaching a
6-
speaker or set of wired headphones.
6+
speaker or set of wired headphones, or by using the built-in speaker **V2**.
77

88
If you are attaching a speaker, a passive piezo buzzer, or headphones, you can
99
use crocodile clips to attach pin 0 and GND to the positive and negative inputs.

docs/tutorials/speech.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ In any case, we're going to create a DALEK poetry recital on demand.
3030
Say Something
3131
+++++++++++++
3232

33-
Before the device can talk you need to plug in a speaker like this:
33+
If you have the latest micro:bit **V2** device, you can use the built-in
34+
speaker as well as or instead of connecting a speaker or set of headphones
35+
like this:
3436

35-
.. image:: ../speech.png
37+
.. image:: pin0-gnd.png
38+
:width: 250px
39+
:align: center
40+
:alt: piezo connected to pin0 and GND
3641

3742
The simplest way to get the device to speak is to import the ``speech`` module
3843
and use the ``say`` function like this::
@@ -46,10 +51,10 @@ change some of the parameters that the speech synthesiser uses to produce the
4651
voice. Our speech synthesiser is quite powerful in this respect because we can
4752
change four parameters:
4853

49-
* ``pitch`` - how high or low the voice sounds (0 = high, 255 = Barry White)
50-
* ``speed`` - how quickly the device talks (0 = impossible, 255 = bedtime story)
51-
* ``mouth`` - how tight-lipped or overtly enunciating the voice sounds (0 = ventriloquist's dummy, 255 = Foghorn Leghorn)
52-
* ``throat`` - how relaxed or tense is the tone of voice (0 = falling apart, 255 = totally chilled)
54+
* ``pitch`` - how high or low the voice sounds (0 = high, 255 = low)
55+
* ``speed`` - how quickly the device talks (0 = fast, 255 = slow)
56+
* ``mouth`` - how tight-lipped or overtly enunciating the voice sounds (0 = closed mouth, 255 = open mouth)
57+
* ``throat`` - how relaxed or tense is the tone of voice (0 = tense, 255 = relaxed)
5358

5459
Collectively, these parameters control the quality of sound - a.k.a. the
5560
timbre. To be honest, the best way to get the tone of voice you want is to

0 commit comments

Comments
 (0)