@@ -751,20 +751,33 @@ APA102 (DotStar) uses a different driver as it has an additional clock pin.
751
751
Capacitive touch
752
752
----------------
753
753
754
- Use the ``TouchPad `` class in the ``machine `` module::
754
+ ESP32, ESP32-S2 and ESP32-S3 support capacitive touch via the ``TouchPad `` class
755
+ in the ``machine `` module::
755
756
756
757
from machine import TouchPad, Pin
757
758
758
759
t = TouchPad(Pin(14))
759
760
t.read() # Returns a smaller number when touched
760
761
761
- ``TouchPad.read `` returns a value relative to the capacitive variation. Small numbers (typically in
762
- the *tens *) are common when a pin is touched, larger numbers (above *one thousand *) when
763
- no touch is present. However the values are *relative * and can vary depending on the board
764
- and surrounding composition so some calibration may be required.
765
-
766
- There are ten capacitive touch-enabled pins that can be used on the ESP32: 0, 2, 4, 12, 13
767
- 14, 15, 27, 32, 33. Trying to assign to any other pins will result in a ``ValueError ``.
762
+ ``TouchPad.read `` returns a value proportional to the capacitance between the
763
+ pin and the board's Ground connection. On ESP32 the number becomes smaller when
764
+ the pin (or connected touch pad) is touched, on ESP32-S2 and ESP32-S3 the number
765
+ becomes larger when the pin is touched.
766
+
767
+ In all cases, a touch causes a significant change in the return value. Note the
768
+ returned values are *relative * and can vary depending on the board and
769
+ surrounding environment so some calibration (i.e. comparison to a baseline or
770
+ rolling average) may be required.
771
+
772
+ ========= ==============================================
773
+ Chip Touch-enabled pins
774
+ --------- ----------------------------------------------
775
+ ESP32 0, 2, 4, 12, 13, 14, 15, 27, 32, 33
776
+ ESP32-S2 1 to 14 inclusive
777
+ ESP32-S3 1 to 14 inclusive
778
+ ========= ==============================================
779
+
780
+ Trying to assign to any other pins will result in a ``ValueError ``.
768
781
769
782
Note that TouchPads can be used to wake an ESP32 from sleep::
770
783
0 commit comments