User Manual

We determine if the touch is active by seeing the difference between the current 'raw' reading value and the first
value. That means you do need to read the crickit touch pads
without
touching them first.
Try loading this code and touching the four pads while looking at the REPL
If you want to get more specific, you can read the ' raw_value ' value which is a number between 0 and 1023. Because
there's always
some
capacitance its reading you'll see a starting value of about 250.
You can then test against a threshold, or use it to measure how hard someone is pressing against something (a
fingertip vs a palm will give different readings)
import time
from adafruit_crickit import crickit
# Capacitive touch tests
while True:
if crickit.touch_1.value:
print("Touched Cap Touch Pad 1")
if crickit.touch_2.value:
print("Touched Cap Touch Pad 2")
if crickit.touch_3.value:
print("Touched Cap Touch Pad 3")
if crickit.touch_4.value:
print("Touched Cap Touch Pad 4")
import time
from adafruit_crickit import crickit
# Capacitive touch graphing test
touches = (crickit.touch_1, crickit.touch_2, crickit.touch_3, crickit.touch_4)
# Open up the serial Plotter in Mu to see the values graphed!
while True:
touch_raw_values = (crickit.touch_1.raw_value, crickit.touch_2.raw_value,
crickit.touch_3.raw_value, crickit.touch_4.raw_value)
print(touch_raw_values)
time.sleep(0.1)
© Adafruit Industries
https://learn.adafruit.com/adafruit-crickit-creative-robotic-interactive-
construction-kit
Page 112 of 201