Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: Copyright (c) 2022 ladyada for Adafruit Industries
2#
3# SPDX-License-Identifier: Unlicense
4
5import time
6import board
7from adafruit_tca8418 import TCA8418
8
9i2c = board.I2C() # uses board.SCL and board.SDA
10# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
11tca = TCA8418(i2c)
12
13# get a 'digitalio' like pin from the tca
14led = tca.get_pin(TCA8418.R0)
15
16# Setup R0 as an output that's at a low logic level default
17led.switch_to_output(value=False)
18
19while True:
20 led.value = True
21 time.sleep(0.2)
22 led.value = False
23 time.sleep(0.2)