ESP32 + SHT31 don´t work

Hello,

I would like to make a thermometer that will show values ​​through the application but for some reason still shows 0.
but when i try through the SHT31 example it works. does anyone know where the bug is?
thank you

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <SHT3x.h>
SHT3x Sensor;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "1489938d543349cf873c5487323c74d2";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "NETGEAR41";
char pass[] = "rapidapple717";


BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = Sensor.GetTemperature();
  float t = Sensor.GetRelHumidity(); // or dht.readTemperature(true) for Fahrenheit
  Serial.println(h,t);

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup()
{
    Sensor.Begin();
  // Debug console
  Serial.begin(9600);

Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,118), 8080);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);


  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{

  Blynk.run();
  timer.run();

Where is the i2c address definition?

Can you post the example code you are using?

1 Like

thank you for help

/*
* The simplest operation using SHT3x
*/

#include <SHT3x.h>
SHT3x Sensor;
void setup() {
  
  Serial.begin(19200);
  Sensor.Begin();
}

void loop() {

  Sensor.UpdateData();
  Serial.print("Temperature: ");
  Serial.print(Sensor.GetTemperature());
  Serial.write("\xC2\xB0"); //The Degree symbol
  Serial.println("C");
  Serial.print("Humidity: ");
  Serial.print(Sensor.GetRelHumidity());
  Serial.println("%");

  delay(333);
}

What library are you using?

Can you remove these lines and check it again?

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;