pcf8574

command
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Pcf8574 writes consecutive numbers to the remote I/O expander chip (PCF8574) using I2C protocol.

The easiest way to try this example is to use a PCF8574 based module intended for LCD displays and one or more LEDs. Low-voltage LEDs like red ones require a current limiting resistor of the order 150-200 Ω. High voltage LEDs like the white ones may work without any resistor.

Connect your LEDs between pin 2 (closest to the I2C connector, 3.3V) and pins 4, 5, 6 (PCF8574 P0, P1, P2 outputs). If you have more LEDs you can connect four more to the pins 11, 12, 13, 14. Polarity matters. Pin 2 should be connected to the anodes of all LEDs. The easiest way to do it is to use a breadboard. Next connect the module pins GND, VCC, SDA, SCL to the Pico pins GND, 3.3V, 20, 21. After programming your Teensy with this example the LEDs should start blinking with different frequencies.

As the LEDs are connected between 3.3V and P0, P1, P2 writing the corresponding bit zero turns the LED on, writting it one turns it off. Because of its quasi-bidirectional I/O the PCF8574 can't source enough current to stable light a LED connected between Px pin and GND (ones are weak so if you set pin high it can work as an input). On the other hand PCF8574 can sink enough current to light the LEDs (zeros are strong).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL