Page 1 of 1

ESP32 7 inch display - how to connect sensor using i2c pin and also use touch with it

Posted: Wed Apr 23, 2025 11:51 am
by linnalahti
I have crowpanel 7.0 v3.0 and ENS160 connected to I2C but touch screen is not working with ENS160! If I add Wire.begin(19,20); before ENS160 code then ENS160 works ok, if not then ENS160 do not work. Here is setup code:

Code: Select all

void setup() {
Serial.begin(115200);
delay(3500);

#if defined(CrowPanel_50) || defined(CrowPanel_70)
  //touch timing init
  pinMode(38, OUTPUT);
  digitalWrite(38, LOW);

  Wire.begin(19, 20);
  Out.reset();
  Out.setMode(IO_OUTPUT);
  Out.setState(IO0, IO_LOW);
  Out.setState(IO1, IO_LOW);
  delay(20);
  Out.setState(IO0, IO_HIGH);
  delay(100);
  Out.setMode(IO1, IO_INPUT);
  Serial.println("lapi");
#endif

  Wire.endTransmission();
  delay(100);

  Wire.begin(19, 20);  //Needs this for ENS160 working

  ens160.enableDebugging(Serial);
  ens160.begin(&Wire, I2C_ADDRESS); //0x53
  while (ens160.init() != true) { //chek if ok
    Serial.print(".");
    delay(15000);
  }
  Serial.println("success");
  ens160.startStandardMeasure();

  if (aht20.begin() == false) { // Temperature sensor in ENS160
    Serial.println("AHT20 not detected. Please check wiring. Freezing.");
    while (1)
      ;
  }
  Serial.println("AHT20 acknowledged.");
  Wire.endTransmission();
}