code.py
1 # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries 2 # SPDX-License-Identifier: Unlicense 3 """ 4 CircuitPython Capacitive Touch Pin Example - Print to the serial console when one pin is touched. 5 """ 6 import time 7 import board 8 import touchio 9 10 touch = touchio.TouchIn(board.D9) 11 12 while True: 13 if touch.value: 14 print("Pin touched!") 15 time.sleep(0.1)