EasyManuals Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #174 background imageLoading...
Page #174 background image
import board
import touchio
touch_one = touchio.TouchIn(board.A4)
touch_two = touchio.TouchIn(board.D12)
while True:
if touch_one.value:
print("Pin one touched!")
if touch_two.value:
print("Pin two touched!")
time.sleep(0.1)
Touch the pins to see the messages printed to the serial console!
This example builds on the first. The imports remain the same.
The touchio.TouchIn() object is created, but is instead saved to touch_one . A
second touchio.TouchIn() object is also created, the second pin is provided to it
using the board module, and is saved to touch_two .
Inside the loop, we check to see if pin one and pin two are touched, and if so, print to
the serial console Pin one touched! and Pin two touched! , respectively. The
same time.sleep() is included.
If more touch-capable pins are available on your board, you can easily add them by
expanding on this example!
The Available Touch-Capable Pins
A4 - CircuitPython: board.A4 . Arduino: T14 .
A5 - CircuitPython: board.A5 . Arduino: T8 .
D13 - CircuitPython: board.D13 . Arduino: T13 .
D12 - CircuitPython: board.D12 . Arduino: T12 .
D11 - CircuitPython: board.D11 . Arduino: T11 .
©Adafruit Industries Page 174 of 263

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
BrandAdafruit
ModelESP32-S3
CategoryMicrocontrollers
LanguageEnglish

Related product manuals