adafruit_pcf8574
¶
Python library for PCF8574 GPIO expander
Author(s): ladyada
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_pcf8574.DigitalInOut(pin_number: int, pcf: PCF8574)¶
Digital input/output of the PCF8574. The interface is exactly the same as the digitalio.DigitalInOut class, however:
PCF8574 does not support pull-down resistors
PCF8574 does not actually have a sourcing transistor, instead there’s an internal pullup
Exceptions will be thrown when attempting to set unsupported pull configurations.
Specify the pin number of the PCF8574 0..7, and instance.
- property direction: Direction¶
Setting a pin to OUTPUT drives it low, setting it to an INPUT enables the light pullup.
- property pull: digitalio.Pull.UP¶
Pull-up is always activated so always return the same thing
- switch_to_input(pull: Pull | None = None, **kwargs) None ¶
Switch the pin state to a digital input which is the same as setting the light pullup on. Note that true tri-state or pull-down resistors are NOT supported!
- class adafruit_pcf8574.PCF8574(i2c_bus: I2C, address: int = 32)¶
Interface library for PCF8574 GPIO expanders :param ~busio.I2C i2c_bus: The I2C bus the PCF8574 is connected to. :param int address: The I2C device address. Default is
0x20
- get_pin(pin: int) DigitalInOut ¶
Convenience function to create an instance of the DigitalInOut class pointing at the specified pin of this PCF8574 device. :param int pin: pin to use for digital IO, 0 to 7