opa eu achei uma biblioteca para usar com o PCF8574
ficou mais simples:
#include <PCF8574.h> // Required for ... all
#include <Wire.h> // Required for I2C communication
PCF8574 expander; // Create object from PCF8574 class
void setup(){
Serial.begin(9600); // Setup serial for read echo
expander.pinMode(0,OUTPUT); // Setup pin D0 as output
expander.pinMode(1,OUTPUT); // Setup pin D1 as output
expander.pinMode(2,OUTPUT); // Setup pin D2 as output
expander.set(); // coloca todas as saidas em HIGH
expander.begin(0x20);
}
void loop(){
expander.digitalWrite(0, LOW); // Blink led 1
delay(1000);
expander.digitalWrite(0, HIGH); // Blink led 2
delay(1000);
} // Loop forever