Skip to content

Commit

Permalink
docs: Add touch_calibrate() for pins 0,1,2, logo.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Sep 16, 2024
1 parent 67fd7c7 commit b2a0dc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/microbit_micropython_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ Each of these pins are instances of the ``MicroBitPin`` class, which offers the
# Only available for touch pins 0, 1, and 2. Sets the touch mode.
# Value can be either RESISTIVE or CAPACITIVE
pin.set_touch_mode(value)
# Only available for touch pins 0, 1, and 2. Re-calibrates the touch pin
# detection.
pin.touch_calibrate()

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

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

pin_speaker, as the above ``MicroBitPin`` class, but does not include
``pin.is_touched()``.
Expand Down
6 changes: 6 additions & 0 deletions docs/pin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ its own to that.

.. py:class:: MicroBitTouchPin
.. py:method:: touch_calibrate()
Re-calibrates the touch pin detection.
This is useful when a conductive object is connected to the pin to
be used as a touch sensor.

.. py:method:: is_touched()
Return ``True`` if the pin is being touched with a finger, otherwise
Expand Down

0 comments on commit b2a0dc9

Please sign in to comment.