Simple test

Ensure your device works with this simple test.

examples/pcf8575_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2022 ladyada for Adafruit Industries
 2#
 3# SPDX-License-Identifier: Unlicense
 4
 5import time
 6import board
 7import adafruit_pcf8575
 8
 9print("PCF8575 digitalio LED blink test")
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
13pcf = adafruit_pcf8575.PCF8575(i2c)
14
15# get a 'digitalio' like pin from the pcf
16led = pcf.get_pin(0)
17
18# Setup pin 15 as an output that's at a high logic level default
19led.switch_to_output(value=True)
20
21while True:
22    led.value = True
23    time.sleep(0.2)
24    led.value = False
25    time.sleep(0.2)