Site icon Renzo Mischianti

Cannot set SDA CLK on ESP8266

Hello, been busy with this library, thank you for that, but I have a problem getting the PCF to work on a non-standard SDA and CLK pin definition on an ESP8266. First: what is working: I'm using a ESP8266 which has standard defined data and clock pins. When connecting my PCF to these pins everything is ok: I2C scanner finds an I2C device on 0x20 and a simple read_button progrmam with this lib does work as well. Now the problem: Because of some other hardware connected to the ESP I need to physically change the data line so now I use this in my code: #define SDA 4 // D2=GPIO4 #define SCL 0 // D3=GPIO0 // Set i2c address PCF8574 pcf8574(0x20, SCL, SDA); This all compiles without error but the simple test_button program does not respond. Also, checking if the PCF did start by using this little code gives a KO: if (pcf8574.begin()){ Serial.println("OK"); }else{ Serial.println("KO"); } so the PCF is not being found and it gives an error. When using the I2C scanner and passing the SCL and SDA lines in the wire command (Wire.begin(SDA,CLK);) the program does see the PCF without error which tells me the wire definition is ok and the PCF being found (of course also on 0x@0). So...how can I get the pcf library to use these new SCL and SDA lines? (Just as a bind going test I changed PCF8574 pcf8574(0x20, SCL, SDA); into PCF8574 pcf8574(0x20, SDA, SCL); because the definition with Wire is also (SDA,SCL) but then the compiler returns an error.... Thank you for your response and your work on the library!
Exit mobile version