code.py
 1  # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import time
 6  
 7  import board
 8  import touchio
 9  
10  touch_pad = board.A0  # Will not work for Circuit Playground Express!
11  # touch_pad = board.A1  # For Circuit Playground Express
12  
13  touch = touchio.TouchIn(touch_pad)
14  
15  while True:
16      if touch.value:
17          print("Touched!")
18      time.sleep(0.05)