Adafruit_Learning_System_Gu.../CircuitPython_Essentials/CircuitPython_CapTouch_2Pins/code.py
2022-02-23 13:42:42 -05:00

18 lines
522 B
Python

# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""CircuitPython Essentials Capacitive Touch on two pins example. Does not work on Trinket M0!"""
import time
import board
import touchio
touch_A1 = touchio.TouchIn(board.A1) # Not a touch pin on Trinket M0!
touch_A2 = touchio.TouchIn(board.A2) # Not a touch pin on Trinket M0!
while True:
if touch_A1.value:
print("Touched A1!")
if touch_A2.value:
print("Touched A2!")
time.sleep(0.05)