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:
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();
}
To connect a sensor via I2C to an ESP32 with a 7-inch display and use touch functionality, follow these steps:
Wiring I2C: Connect the sensor’s SDA to GPIO21 (default SDA) and SCL to GPIO22 (default SCL) on the ESP32.
Touch Screen: Use the TFT touch screen with an I2C controller, typically on pins SDA and SCL as well, or use separate pins if it's not using I2C. Ensure the display's touch functionality is compatible with the ESP32.
Libraries: Use the Adafruit I2C and TFT_eSPI libraries for proper communication with both the display and the sensor.
Make sure to check your display’s specific wiring if it's not I2C-based and adjust code accordingly.
Comments
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:
void setup() {
Serial.begin(115200);
delay(3500);
What is missing?
To connect a sensor via I2C to an ESP32 with a 7-inch display and use touch functionality, follow these steps:
Make sure to check your display’s specific wiring if it's not I2C-based and adjust code accordingly.
GPIO21 is in use for display R4: I can not find GPIO22 in ESP32 S3 pins! Why there is a I2C connector if it cannot be use.
Can someone help print workable code.