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
6
7import board
8
9import adafruit_pcf8575
10
11print("PCF8575 digitalio LED blink test")
12
13i2c = board.I2C() # uses board.SCL and board.SDA
14# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
15pcf = adafruit_pcf8575.PCF8575(i2c)
16
17# get a 'digitalio' like pin from the pcf
18led = pcf.get_pin(0)
19
20# Setup pin 15 as an output that's at a high logic level default
21led.switch_to_output(value=True)
22
23while True:
24 led.value = True
25 time.sleep(0.2)
26 led.value = False
27 time.sleep(0.2)