diff --git a/docs/microbit_micropython_api.rst b/docs/microbit_micropython_api.rst index 8f8031d9f..19362fdac 100644 --- a/docs/microbit_micropython_api.rst +++ b/docs/microbit_micropython_api.rst @@ -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, 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) Except in the case of the pins marked **V2**, which offers the following API: @@ -156,6 +159,8 @@ pin_logo:: # returns boolean for logo touch pin pin_logo.is_touched() + # Sets the touch mode. Value can be either RESISTIVE or CAPACITIVE + pin.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 7e7ed7de6..29da1b663 100644 --- a/docs/pin.rst +++ b/docs/pin.rst @@ -73,9 +73,6 @@ they are internally connected to. The pins are available as attributes on the | 20 | Digital | I2C SDA | I2C SDA | +-----+---------+----------+-----------------+ -The above table summarizes the pins available, their types (see below) and what -they are internally connected to. - The latest micro:bit device **V2** has two additional pins that you can access in MicroPython, but that are not available via the edge connector: @@ -207,7 +204,7 @@ its own to that. The default touch mode for the pins on the edge connector is `resistive`. The default for the logo pin **V2** is `capacitive`. - **Resitive touch** + **Resistive touch** This test is done by measuring how much resistance there is between the pin and ground. A low resistance gives a reading of ``True``. To get a reliable reading using a finger you may need to touch the ground pin @@ -218,6 +215,15 @@ its own to that. using a finger as a conductor. `Capacitive touch `_ does not require you to make a ground connection as part of a circuit. + + .. py:method:: set_touch_mode(value) + + .. note:: + The default touch mode for the pins on the edge connector is + `resistive`. The default for the logo pin **V2** is `capacitive`. + + Set the touch mode for the given pin. Value can be either ``CAPACITIVE`` + or ``RESISTIVE``. For example, ``pin0.set_touch_mode(pin0.CAPACITIVE)``. The pull mode for a pin is automatically configured when the pin changes to an input mode. Input modes are when you call ``read_analog`` / ``read_digital`` /