Simple test

Ensure your device works with this simple test.

examples/tt21100_simpletest.py
 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
11
12import board
13import busio
14
15import adafruit_tt21100
16
17# Create library object (named "tt") using a Bus I2C port
18i2c = busio.I2C(board.SCL, board.SDA)
19
20tt = adafruit_tt21100.TT21100(i2c)
21
22while True:
23    # if the screen is being touched print the touches
24    if tt.touched:
25        print(tt.touches)
26
27    time.sleep(0.15)