Hi,
I try to understand the PCF8574 chip. I didn't get it to work in an expected way. Do I miss something?
I use the library from Rob Tillaart or pure i2c_write_blocking.
In both ways I can't write a zero to the chip to pull all ports to ground. On four ports are LEDs and they are just switched on above zero (0000 0001 for instance). Each LED consumes 6mA, so a current limit shouldn't be the problem. After sending the zero, the reading gives 15 back.
It may be easier to start with a much simpler sketch which simply tries to switch a port low or high and see how that performs. The PCF8574 has a very weak high (c. 100uA) and a strongish (c. 20mA) low so can sink a led but not source it. Say how you have wired the leds.
I use the pico board with a rp2040 on top.
The LEDs are on a breadboard 5V - LED - 150Ohm - PCF8574 - GND.
The chip itself is connected to the 3V3 pin of the pico board
at the moment it seem so, pulling up the not used ports of the pcf8574 solves my problem.
Sending now a value with zero at the 4 lsb, all four LED are light up.