PCF8574: how to use readButton function?

Hello

I made another post about a problem to read PCF8574 port where are input are always at a LOW level, even when I use the internal PULLUP instruction.

I found that there is a function that could be use to resolve the problem, but don’t understand how to use it.

Any information appreciated.

Martin

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded the PCF8574 library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

Go to this link it will teach you how to use it. Arduino Playground - PCF8574Class. As far as being low you either do not have it connected properly or are programming it wrong. If the above link does not solve your problem get an arduino cook book. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

Resolved by writing a high level on the pins before reading them

void setup() 
{
  Serial.begin(9600);
  Wire.begin();
  Wire.beginTransmission(0x20);
  Wire.write(0xff); //Led is off
  Wire.endTransmission();

}

void loop() 
{
  readbouton();
}

 void readbouton()
 {
  byte _data;
  const int debounce = 225;
 
  Wire.begin();
 
  Wire.requestFrom(0x20, 1);
  if(Wire.available()) {
    _data = Wire.read();

    if (_data == 254){ Serial.println ("bouton S1");
    delay(debounce);}

    if (_data == 251){ Serial.println ("bouton S3");
    delay(debounce);}

    if (_data == 247){ Serial.println ("bouton S4");
    delay(debounce);}
    
    if (_data == 239){ Serial.println ("bouton S5");
    delay(debounce);}

    if (_data == 223){ Serial.println ("bouton S6");
    delay(debounce);}

    if (_data == 191){ Serial.println ("bouton S7");
    delay(debounce);}
  }
 
 }