Simple test

Ensure your device works with this simple test.

examples/aw9523_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2020 ladyada for Adafruit Industries
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import board
 6import digitalio
 7import adafruit_aw9523
 8
 9i2c = board.I2C()
10aw = adafruit_aw9523.AW9523(i2c)
11
12led_pin = aw.get_pin(0)  # LED on AW9523 io 0
13button_pin = aw.get_pin(1)  # Button on AW io 1
14
15# LED is an output, initialize to high
16led_pin.switch_to_output(value=True)
17# Button is an input, note pull-ups are not supported!
18button_pin.direction = digitalio.Direction.INPUT
19
20while True:
21    # LED mirrors button pin
22    led_pin.value = button_pin.value