code.py
 1  # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
 2  # SPDX-License-Identifier: MIT
 3  """
 4  CircuitPython Capacitive Two Touch Pin Example for ESP32-S2
 5  Print to the serial console when a pin is touched.
 6  """
 7  import time
 8  import board
 9  import touchio
10  
11  touch_one = touchio.TouchIn(board.D8)
12  touch_two = touchio.TouchIn(board.D5)
13  
14  while True:
15      if touch_one.value:
16          print("Pin one touched!")
17      if touch_two.value:
18          print("Pin two touched!")
19      time.sleep(0.1)