code.py
 1  # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  # CircuitPython Demo - Cap Touch Multiple Pins
 6  # Example does NOT work with Trinket M0!
 7  
 8  import time
 9  
10  import board
11  import touchio
12  
13  touch_A1 = touchio.TouchIn(board.A1)  # Not a touch pin on Trinket M0!
14  touch_A2 = touchio.TouchIn(board.A2)  # Not a touch pin on Trinket M0!
15  
16  while True:
17      if touch_A1.value:
18          print("Touched A1!")
19      if touch_A2.value:
20          print("Touched A2!")
21      time.sleep(0.05)