10-10-2023, 02:35 AM
Code:
/*Read SHT31 sensor Temperature and Humidity*/
#include "Wire.h"
#include "SHT31.h"
#define SHT31_ADDRESS_1 0x44
SHT31 sht_1(&Wire);
bool b1;
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println(SHT31_LIB_VERSION);
Wire.begin(4,5);
Wire.setClock(100000);
b1 = sht_1.begin(SHT31_ADDRESS_1);
}
void loop()
{
if (b1) sht_1.read();
Serial.print("Temperature:");
Serial.print(sht_1.getTemperature(), 1);
Serial.print("\t");
Serial.print("Humidity:");
Serial.print(sht_1.getHumidity(), 1);
Serial.print("\t");
Serial.println();
delay(1000);
}