Skip to content

Commit

Permalink
docs: Add was_touched method for pins 0,1,2 & pin_logo.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Mar 4, 2024
1 parent acee09a commit 828de9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/microbit_micropython_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ 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, and 2. Returns boolean if the pin
# has been touched since the last time this method was called
pin.was_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)
Expand All @@ -157,8 +160,11 @@ Except in the case of the pins marked **V2**, which offers the following API:

pin_logo::

# returns boolean for logo touch pin
# returns a boolean for logo touch pin
pin_logo.is_touched()
# returns a boolean if the logo was pressed since the last time
# this method was called
pin_logo.was_touched()
# Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE
pin.set_touch_mode(value)

Expand Down
5 changes: 5 additions & 0 deletions docs/pin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ its own to that.
<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:: was_touched()
Returns ``True`` or ``False`` to indicate if the pin was touched
since the device started or since the last time this method was called.

.. py:method:: set_touch_mode(value)
.. note::
Expand Down

0 comments on commit 828de9a

Please sign in to comment.