Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2# SPDX-FileCopyrightText: Copyright (c) 2022 Scott Shawcroft for Adafruit Industries
3#
4# SPDX-License-Identifier: Unlicense
5
6"""
7Example for getting touch data from a TT21100 capacitive touch driver over I2C
8"""
9
10import time
11import busio
12import board
13import adafruit_tt21100
14
15# Create library object (named "tt") using a Bus I2C port
16i2c = busio.I2C(board.SCL, board.SDA)
17
18tt = adafruit_tt21100.TT21100(i2c)
19
20while True:
21 # if the screen is being touched print the touches
22 if tt.touched:
23 print(tt.touches)
24
25 time.sleep(0.15)