I used PCF8574 expander in a bunch of projects, but output only. Now I am on some project where I need it as input. There comes the problem
Although I have a button with a pull-down resistor, it always shows LOW. When I don't press the button on the multimeter I can see there is GND on the P6, the pin I tied button. When I press the button, there is a 3,3V (3,3V logic I use here). So, on P6 I have LOW or HIGH. But, on Serial, I always get LOW, no matter what comes to P6.
Serial.print("Init pcf8574...");
if (pcf8574.begin()){
Serial.println("OK");
}else{
Serial.println("KO");
}
To initialize the 8574.
I hope this is the library you are using?
Can you post a link to where you got your library please?
Have you looked at the examples?
Tom...
To read it you first must set all the Outputs high (0xFF). The outputs are pseudio I/O where the pull down is an active NFET and the pull is accomplished with a pinch fet. Simply stated it has a pull up resistor and a mosfet output that is only active low. When the pins are read it returns the value on the pins not the output register and there is no input register. Setting the outputs low and placing +5V on them can fry the chip.