code.py
1 # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries 2 # SPDX-License-Identifier: MIT 3 """ 4 CircuitPython Capacitive Touch Pad Example - Print to the serial console when one pad is touched. 5 6 Update TOUCH_PAD_PIN to the touch pad pin name for the board you're using. 7 8 For example: 9 If you are using the BLM Badge, update TOUCH_PAD_PIN to CAP1. 10 If using a CPX, update TOUCH_PAD_PIN to A1. 11 """ 12 import time 13 import board 14 import touchio 15 16 touch = touchio.TouchIn(board.TOUCH_PAD_PIN) 17 18 while True: 19 if touch.value: 20 print("Pad touched!") 21 time.sleep(0.1)