Skip to content

Commit e5558b1

Browse files
authored
Merge pull request #747 from dcbriccetti/shorter-cap-touch
Create a shorter CapTouch program
2 parents d82be86 + 3dc64ae commit e5558b1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""A shorter CapTouch program, for those comfortable with list
2+
comprehensions and the enumerate function"""
3+
4+
import time
5+
6+
import board
7+
import touchio
8+
9+
touchIns = [touchio.TouchIn(pin) for pin in
10+
(board.A1, board.A2, board.A3, board.A4, board.A5, board.A6, board.A7)]
11+
12+
while True:
13+
for i, touchIn in enumerate(touchIns):
14+
if touchIn.value:
15+
print('A%d touched!' % (i + 1))
16+
17+
time.sleep(0.1)

0 commit comments

Comments
 (0)