Skip to content

Commit f0771c1

Browse files
authored
Merge pull request #2423 from adafruit/reverseTFT_example
adding touchio example
2 parents 498f3f0 + ac2641e commit f0771c1

File tree

1 file changed

+18
-0
lines changed
  • Feather_ESP32-S3_Reverse_TFT_Primary_Guide/CircuitPython_CapTouch

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Capacitive Two Touch Pin Example - Print to the serial console when a pin is touched.
5+
"""
6+
import time
7+
import board
8+
import touchio
9+
10+
touch_one = touchio.TouchIn(board.A4)
11+
touch_two = touchio.TouchIn(board.A5)
12+
13+
while True:
14+
if touch_one.value:
15+
print("Pin one touched!")
16+
if touch_two.value:
17+
print("Pin two touched!")
18+
time.sleep(0.1)

0 commit comments

Comments
 (0)