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

18 lines
443 B
Python

# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""CircuitPython Essentials Capacitive Touch example"""
import time
import board
import touchio
touch_pad = board.A0 # Will not work for Circuit Playground Express!
# touch_pad = board.A1 # For Circuit Playground Express
touch = touchio.TouchIn(touch_pad)
while True:
if touch.value:
print("Touched!")
time.sleep(0.05)