diff --git a/docs/microbit_micropython_api.rst b/docs/microbit_micropython_api.rst index 19362fdac..c2fff60f9 100644 --- a/docs/microbit_micropython_api.rst +++ b/docs/microbit_micropython_api.rst @@ -149,18 +149,29 @@ 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 + # 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, and 2. Returns the running total of + # pin touches, and resets this counter to zero + pin.get_touches() + # 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) 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() + # returns the running total of touches, and resets this counter to zero + pin_logo.get_touches() # Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE - pin.set_touch_mode(value) + pin_logo.set_touch_mode(value) pin_speaker, as the above ``MicroBitPin`` class, but does not include ``pin.is_touched()``. diff --git a/docs/pin.rst b/docs/pin.rst index 635b2015f..82b4e88dd 100644 --- a/docs/pin.rst +++ b/docs/pin.rst @@ -202,6 +202,16 @@ its own to that. Return ``True`` if the pin is being touched with a finger, otherwise return ``False``. + .. 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:: get_touches() + + Returns the number of times the pin was touched + since the device started or since the last time this method was called. + .. py:method:: set_touch_mode(value) .. note::