Simple test

Ensure your device works with this simple test.

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