Simple test

Ensure your device works with this simple test.

examples/tcs3430_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2026 Tim Cocks for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Basic test for TCS3430 XYZ Tristimulus Color Sensor."""
 5
 6import time
 7
 8import board
 9
10from adafruit_tcs3430 import TCS3430, ALSGain, InterruptPersistence
11
12i2c = board.I2C()
13tcs = TCS3430(i2c)
14
15print("TCS3430 Basic Test")
16print("TCS3430 found!")
17
18# --- Tweak these settings for your environment ---
19tcs.als_gain = ALSGain.GAIN_64X  # 1X, 4X, 16X, 64X, or 128X
20tcs.integration_time = 100.0  # 2.78ms to 711ms
21
22while True:
23    x, y, z, ir1 = tcs.channels
24    print(f"X: {x}  Y: {y}  Z: {z}  IR1: {ir1}")
25
26    time.sleep(1.0)