// Preliminar studies for Wokwi epdiy
// Fast signals XCL,STV
int sigIO[5] = {4, 45, 48, 41, 42};
// 8 data out
int dataIO[8] = {5,6,7,15,16,17,18,8};

#include <PCA95x5.h>

// select one of them
PCA9535 ioex;

void setup() {
  Serial.begin(115200);
  // Test IO expander
    Wire.begin(39,40);
    ioex.attach(Wire);
    ioex.polarity(PCA95x5::Polarity::ORIGINAL_ALL);
    ioex.direction(PCA95x5::Direction::OUT);
    ioex.write(PCA95x5::Level::L_ALL);
 delay(1000);
  if(psramInit()){
    Serial.println("\nPSRAM is correctly initialized");
    Serial.print("Total PSRAM:");
    Serial.println(ESP.getPsramSize());
    Serial.print("Free PSRAM: ");
    Serial.println(ESP.getFreePsram());
  }else{
    Serial.println("PSRAM not available");
  }

  for (int i=0; i<5; i++) {
    pinMode(sigIO[i], OUTPUT);
    digitalWrite(sigIO[i], HIGH);
    Serial.printf("Sig:%d H\n", sigIO[i]);
  }
  // Try to explicetely turn HIGH 41 & 48
  digitalWrite(41, HIGH);
  digitalWrite(48, HIGH);
  for (int i=0; i<8; i++) {
    pinMode(dataIO[i], OUTPUT);
    digitalWrite(dataIO[i], HIGH);
    //Serial.printf("Data:%d H\n", dataIO[i]);
    delay(200);
  }
}

void loop() {

    for (int i = 0; i < 16; ++i) {
        Serial.print("set port high: ");
        Serial.println(i);

        ioex.write((PCA95x5::Port::Port) i, PCA95x5::Level::H);
        Serial.println(ioex.read(), BIN);
        delay(200);
    }
    for (int i = 0; i < 16; ++i) {
        Serial.print("set port low: ");
        Serial.println(i);

        ioex.write((PCA95x5::Port::Port) i, PCA95x5::Level::L);
        Serial.println(ioex.read(), BIN);
        delay(200);
    }

}
Loading
esp32-s3-devkitc-1
pca9535Breakout
tps65185Breakout