How to established I2C communication between ESP32 and SHT21 14bits humidity and temperature programing.

Yousuf
Posts: 1
Joined: Fri Oct 13, 2023 10:27 am

How to established I2C communication between ESP32 and SHT21 14bits humidity and temperature programing.

Postby Yousuf » Tue Oct 31, 2023 8:06 am

https://forum.arduino.cc/t/problems-wit ... sor/513169


/****************************************************************
* ReadSHT2x
* An example sketch that reads the sensor and prints the
* relative humidity to the PC's serial port
*
* Tested with:
* - SHT21-Breakout Humidity sensor from Modern Device
* - SHT2x-Breakout Humidity sensor from MisensO Electronics
***************************************************************/

#include <Wire.h>
#include <Sodaq_SHT2x.h>


void setup()
{
Wire.begin();
Serial.begin(115200);
}

void loop()
{
Serial.print("Humidity(%RH): ");
Serial.print(SHT2x.GetHumidity());
Serial.print(" Temperature(C): ");
Serial.println(SHT2x.GetTemperature());
Serial.print(" Dewpoint(C): ");
Serial.println(SHT2x.GetDewPoint());

delay(3000);
}

/////////////////////////////////////////
This code is working well in ESP-07s but this code is unable to communicate with SHT21 sensor in case of ES32 where i am using i2c protocal.

Who is online

Users browsing this forum: No registered users and 85 guests