Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

ESP32 + SHT31
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ESP32 + SHT31

by WAC on Tue Jul 28, 2020 11:58 pm

Hello,
From the datasheet, I read that any PIN of the ESP32 can be used to output the signals from the hardware I2C. Something like

Code: Select all | TOGGLE FULL SIZE
 
#include <Wire.h>
#include <Adafruit_SHT31.h>
...

//I2C BUSES
TwoWire I2C_BUS1  = TwoWire(0);
TwoWire I2C_BUS2 = TwoWire(1);

//SHT instace
Adafruit_SHT31 sht31_sensor = Adafruit_SHT31(&I2C_BUS2);

...

void setup()
{

I2C_BUS1.begin(SDA_PIN1, SCL_PIN1, 10000);
I2C_BUS2.begin(SDA_PIN2, SCL_PIN2, 10000);

sht31_sensor.begin(0x44);
...



But I have a problem with the begin() method of both the Adafruit_I2CDevice class (from Adafruit BusIO) and the Adafruit_SHT31 class (from Adafruit_SHT31 ), as they overwrite the custom call to the TwoWire instance.
I have tried to change the libs locally but it still doesn't work.
Any idea of what is the "recommended way" to fix it?

WAC
 
Posts: 1
Joined: Tue Jul 28, 2020 11:27 pm

Please be positive and constructive with your questions and comments.


cron