Skip to content

Commit b2a0dc9

Browse files
docs: Add touch_calibrate() for pins 0,1,2, logo.
1 parent 67fd7c7 commit b2a0dc9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/microbit_micropython_api.rst

+5
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ Each of these pins are instances of the ``MicroBitPin`` class, which offers the
158158
# Only available for touch pins 0, 1, and 2. Sets the touch mode.
159159
# Value can be either RESISTIVE or CAPACITIVE
160160
pin.set_touch_mode(value)
161+
# Only available for touch pins 0, 1, and 2. Re-calibrates the touch pin
162+
# detection.
163+
pin.touch_calibrate()
161164

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

@@ -172,6 +175,8 @@ pin_logo::
172175
pin_logo.get_touches()
173176
# Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE
174177
pin_logo.set_touch_mode(value)
178+
# Re-calibrates the touch pin detection.
179+
pin.touch_calibrate()
175180

176181
pin_speaker, as the above ``MicroBitPin`` class, but does not include
177182
``pin.is_touched()``.

docs/pin.rst

+6
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ its own to that.
197197

198198
.. py:class:: MicroBitTouchPin
199199
200+
.. py:method:: touch_calibrate()
201+
202+
Re-calibrates the touch pin detection.
203+
This is useful when a conductive object is connected to the pin to
204+
be used as a touch sensor.
205+
200206
.. py:method:: is_touched()
201207
202208
Return ``True`` if the pin is being touched with a finger, otherwise

0 commit comments

Comments
 (0)