Skip to content

Commit 4043fc2

Browse files
docs: Add get_touches() to MicroBitTouchPin.
1 parent a534984 commit 4043fc2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

docs/microbit_micropython_api.rst

+5
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ Each of these pins are instances of the ``MicroBitPin`` class, which offers the
152152
# Only available for touch pins 0, 1, and 2. Returns boolean if the pin
153153
# has been touched since the last time this method was called
154154
pin.was_touched()
155+
# Only available for touch pins 0, 1, and 2. Returns the running total of
156+
# pin touches, and resets this counter to zero
157+
pin.get_touches()
155158
# Only available for touch pins 0, 1, 2 and on micro:bit V2 also the logo.
156159
# Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE
157160
pin.set_touch_mode(value)
@@ -165,6 +168,8 @@ pin_logo::
165168
# returns a boolean if the logo was pressed since the last time
166169
# this method was called
167170
pin_logo.was_touched()
171+
# returns the running total of touches, and resets this counter to zero
172+
pin.get_touches()
168173
# Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE
169174
pin.set_touch_mode(value)
170175

docs/pin.rst

+5
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ its own to that.
207207
Returns ``True`` or ``False`` to indicate if the pin was touched
208208
since the device started or since the last time this method was called.
209209

210+
.. py:method:: get_touches()
211+
212+
Returns the number of times the pin was touched
213+
since the device started or since the last time this method was called.
214+
210215
.. py:method:: set_touch_mode(value)
211216
212217
.. note::

0 commit comments

Comments
 (0)