Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino source code for KC868-M16 V2]-SHT31 sensor detect code
#1
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);
}
install library SHT31
   
   
Reply


Messages In This Thread
[Arduino source code for KC868-M16 V2]-SHT31 sensor detect code - by KinCony Support - 10-10-2023, 02:35 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)