Adafruit_Learning_System_Gu.../MetroX_CircuitPython/touch/code.py
2022-02-22 13:45:02 -05:00

26 lines
498 B
Python

# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
'touch.py'
=================================================
capactive touch with the Adafruit Metro
requires:
- touchio
"""
import time
import board
import digitalio
import touchio
led = digitalio.DigitalInOut(board.D13)
led.switch_to_output()
touch = touchio.TouchIn(board.A1)
while True:
if touch.value:
led.value = True
else:
led.value = False
time.sleep(1)