Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1be9e87
docs: Update the docs to include the V2 API (#692)
microbit-mark Dec 3, 2020
71d5eef
Docs: update for V2 neopixel module (#694)
microbit-mark Dec 18, 2020
353e6e1
Docs: Speaker update and play() pin arguments (#695)
microbit-mark Dec 18, 2020
5357b8e
V2 docs: Remove is_on() from speaker. (#696)
microbit-carlos Dec 21, 2020
f9a37b4
V2 docs: Add pin set_touch_mode() (#701)
microbit-mark Jan 8, 2021
070e590
docs: Update Memory layout, Partial Flashing, Building for V2, BLE (#…
microbit-sam Feb 3, 2021
5774623
docs: Include V2 features in tutorials (#709)
microbit-mark Feb 24, 2021
c967053
docs: dev guide updates (#711)
microbit-mark Mar 16, 2021
eab72dd
docs: Indicate pin_speaker is only for PWM (#715)
microbit-mark Apr 7, 2021
79aced6
docs: Fix typo in neopixel, mumber -> number (#727)
microbit-matt-hillsdon Sep 23, 2021
8bc1fe8
docs: Add V2 microbit.set_volume() info. (#742)
microbit-carlos Apr 25, 2022
a870ff4
docs: Add note about possible 250kbit/sec radio rate in V2. (#744)
microbit-carlos Apr 29, 2022
8007c9e
docs: Add data logging API (#720)
microbit-mark Sep 5, 2022
8c107e9
docs: Add Power Management documentation. (#754)
microbit-carlos Sep 5, 2022
1e4265a
docs: Add Sound Effects documentation. (#753)
microbit-carlos Sep 6, 2022
44c2c1a
docs: Add missing `days` parameter to `microbit.run_every`. (#767)
microbit-carlos Sep 12, 2022
0d6f5b7
docs: Rename wave->waveform from SoundEffect. (#765)
microbit-carlos Sep 21, 2022
a538cb8
docs: Update Power Mgm to change run_every behaviour. (#769)
microbit-carlos Oct 24, 2022
202fab2
docs: Overwrite configued version always be '2' for v2-docs.
microbit-carlos Nov 15, 2022
8c42897
docs: Update URL to download arm-none-eabi-gcc. (#787)
microbit-carlos Dec 6, 2022
905577a
docs: Improve microphone description, add more info for `set_threshol…
microbit-carlos Apr 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
V2 docs: Add pin set_touch_mode() (#701)
* V2 docs: add set_touch_mode()

* V2 docs: add set_touch_mode() to micropython API doc
  • Loading branch information
microbit-mark authored and microbit-carlos committed Sep 16, 2024
commit f9a37b4ce3de9dae4ebc93df701af779a1e466d2
5 changes: 5 additions & 0 deletions docs/microbit_micropython_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,18 @@ Each of these pins are instances of the ``MicroBitPin`` class, which offers the
# Only available for touch pins 0, 1, and 2. Returns boolean if the pin
# is touched
pin.is_touched()
# Only available for touch pins 0, 1, 2 and on micro:bit V2 also the logo.
# Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE
pin.set_touch_mode(value)

Except in the case of the pins marked **V2**, which offers the following API:

pin_logo::

# returns boolean for logo touch pin
pin_logo.is_touched()
# Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE
pin.set_touch_mode(value)

pin_speaker, as the above ``MicroBitPin`` class, but does not include
``pin.is_touched()``.
Expand Down
14 changes: 10 additions & 4 deletions docs/pin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ they are internally connected to. The pins are available as attributes on the
| 20 | Digital | I2C SDA | I2C SDA |
+-----+---------+----------+-----------------+

The above table summarizes the pins available, their types (see below) and what
they are internally connected to.

The latest micro:bit device **V2** has two additional pins that you can access
in MicroPython, but that are not available via the edge connector:

Expand Down Expand Up @@ -207,7 +204,7 @@ its own to that.
The default touch mode for the pins on the edge connector is
`resistive`. The default for the logo pin **V2** is `capacitive`.

**Resitive touch**
**Resistive touch**
This test is done by measuring how much resistance there is between the
pin and ground. A low resistance gives a reading of ``True``. To get
a reliable reading using a finger you may need to touch the ground pin
Expand All @@ -218,6 +215,15 @@ its own to that.
using a finger as a conductor. `Capacitive touch
<https://www.allaboutcircuits.com/technical-articles/introduction-to-capacitive-touch-sensing>`_
does not require you to make a ground connection as part of a circuit.

.. py:method:: set_touch_mode(value)

.. note::
The default touch mode for the pins on the edge connector is
`resistive`. The default for the logo pin **V2** is `capacitive`.

Set the touch mode for the given pin. Value can be either ``CAPACITIVE``
or ``RESISTIVE``. For example, ``pin0.set_touch_mode(pin0.CAPACITIVE)``.

The pull mode for a pin is automatically configured when the pin changes to an
input mode. Input modes are when you call ``read_analog`` / ``read_digital`` /
Expand Down