Skip to content

Commit

Permalink
Merge pull request #25 from FoamyGuy/touchio_example
Browse files Browse the repository at this point in the history
adding touchio example
  • Loading branch information
ladyada committed Oct 31, 2020
2 parents 3569774 + 0961c83 commit 78bfed3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/debouncer_touchio_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
This example shows how to use the debouncer library on the signals coming from
a cap-sense pin with touchio.
"""
import time
import board
import touchio
from adafruit_debouncer import Debouncer

touch_pad = board.A1
touch = touchio.TouchIn(touch_pad)
touch_debounced = Debouncer(touch)

while True:
touch_debounced.update()
if touch_debounced.fell:
print("Just released")
if touch_debounced.rose:
print("Just pressed")
if touch_debounced.value:
print("touching")
else:
# print('not touching')
pass
time.sleep(0.05)

0 comments on commit 78bfed3

Please sign in to comment.