Site icon Renzo Mischianti

PCF8575 on esp32

Hi,, I have been trying to use this library with esp32 but no luck so far.. All I want to do is toggle some relays connected on the extender IC but while running the IC doesn't seem to respond.. The I2C scanner shows the address at 0x20.. and my SDA, SCL pins are connected to 21 and 22 respectively.. Not sure, what I am doing wrong.. code below..   #include "Arduino.h" #include "PCF8575.h" // Set i2c address PCF8575 pcf8575(0x20); void setup() { Serial.begin(115200); // Set pinMode to OUTPUT for(int i=0;i<8;i++) { pcf8575.pinMode(i, OUTPUT); } pcf8575.begin(); } void loop() { static int pin = 0; pcf8575.digitalWrite(pin, HIGH); Serial.println("ON"); delay(1000); pcf8575.digitalWrite(pin, LOW); Serial.println("OFF"); delay(1000); pin++; if (pin > 7) pin = 0; }        
Exit mobile version