One more question please about the PCF8575.
I'm looking at the datasheet and I'm confused how to hook up the switches. In the datasheet there is a pic with a few examples. The example shows a 100K pull-up on port 05 and a switch, but there is a second resistor just beside the switch. What's its function and what value should it be?
I am feeling some Déjà vu here, that we have been here before.
However surprising it might be, the switch and resistor to Vcc is obviously a
mistake. It is quite useless to connect switches from PCF8575 pins to Vcc, with or without series resistors.
If you want the IC to read switches, you connect them from pins to
ground. The PCF8575 provides relatively weak pull-ups and they are
not linear. Paragraph 9.2.1.1 explains why you might need to provide the external 100k pull-ups (
including for LEDs) if you are concerned about current consumption as you might be for battery operation - I do not believe this is a concern to you so you can ignore them.
The LEDs
do connect to Vcc as the PCF8575 can pull the outputs down but not up to any useful extent as far as LEDs are concerned - this is a frequent trap for newbies.
If it suits you that the LED will always be illuminated if the corresponding switch is closed, you can use the
same pin for the switch and LED, needing only half as many pins.