Tell us about yourself!
The recommended LED connection is wrong. PCF8574 output is design to sink not source. I've tested according to the connection and it fail. After troubleshooting for 2 days and finally I found out from the datasheet that the source current is only 300uA and the sink current is 10-25mA. I'm very unlucky that I'm using old LEDs to experiment that the intensity is very low and that is why i can't manage to see the circuit works.After I connected the LED in sink mode, (LED anode connected to +ve 5V and LED cathode connected tp PCF8574 ouput, it works fine.The software has to be inverted. I just add reserveLogic = i ^ 0xff; to invert the i then IOexpanderWrite(DEVICE_1, reverseLogic);