code.py
1 # SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 # Trinket IO demo - captouch 6 7 import time 8 9 import board 10 import touchio 11 12 touch0 = touchio.TouchIn(board.D1) 13 touch1 = touchio.TouchIn(board.D3) 14 touch2 = touchio.TouchIn(board.D4) 15 16 while True: 17 if touch0.value: 18 print("D1 touched!") 19 if touch1.value: 20 print("D3 touched!") 21 if touch2.value: 22 print("D4 touched!") 23 time.sleep(0.01)