code.py
1 # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 """CircuitPython Essentials Capacitive Touch on two pins example. Does not work on Trinket M0!""" 6 import time 7 import board 8 import touchio 9 10 touch_A1 = touchio.TouchIn(board.A1) # Not a touch pin on Trinket M0! 11 touch_A2 = touchio.TouchIn(board.A2) # Not a touch pin on Trinket M0! 12 13 while True: 14 if touch_A1.value: 15 print("Touched A1!") 16 if touch_A2.value: 17 print("Touched A2!") 18 time.sleep(0.05)