Adafruit ESP32-S3 Manual page 172

Tft feather
Table of Contents

Advertisement

pin is touched.
"""
import time
import board
import touchio
touch = touchio.TouchIn(board.A4)
while True:
if touch.value:
print("Pin touched!")
time.sleep(0.1)
Now touch the pin indicated in the diagram above. You'll see
to the serial console!
First you
import
modules available for use in your code. All three are built-in to CircuitPython, so you
don't find any library files in the Project Bundle.
Next, you create the
the
module. You save that to the
board
Inside the loop, you check to see if the pin is touched. If so, you print to the serial
console. Finally, you include a
readable.
That's all there is to reading touch on a single pin using
Multiple Capacitive Touch Pins
The next example shows you how to read touches on multiple pins in a single
program.
©Adafruit Industries
three modules:
time
touchio.TouchIn()
time.sleep()
,
and
board
touchio
object, and provide it the pin name using
variable.
touch
to slow it down a bit so the output is
touchio
printed
Pin touched!
. This makes these
in CircuitPython!
Page 172 of 263

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents

Save PDF