GY-63_MS5611/libraries/SHT85/examples/SHT85_demo/SHT85_demo.ino

62 lines
1.0 KiB
Arduino
Raw Normal View History

2021-05-26 06:06:51 -04:00
//
// FILE: SHT85_demo.ino
// AUTHOR: Rob Tillaart
2021-08-24 13:59:51 -04:00
// VERSION: 0.2.0
2021-05-26 06:06:51 -04:00
// PURPOSE: demo
// URL: https://github.com/RobTillaart/SHT85
// TOPVIEW
// +-------+
// +-----\ | SDA 4 -----
// | +-+ ----+ GND 3 -----
// | +-+ ----+ +5V 2 -----
// +-----/ | SCL 1 -----
// +-------+
#include "SHT85.h"
#define SHT85_ADDRESS 0x44
uint32_t start;
uint32_t stop;
SHT85 sht;
2021-05-28 07:46:01 -04:00
2021-05-26 06:06:51 -04:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
2021-08-24 13:59:51 -04:00
Serial.print("SHT_LIB_VERSION: \t");
Serial.println(SHT_LIB_VERSION);
2021-05-26 06:06:51 -04:00
Wire.begin();
sht.begin(SHT85_ADDRESS);
Wire.setClock(100000);
uint16_t stat = sht.readStatus();
Serial.print(stat, HEX);
Serial.println();
}
2021-05-28 07:46:01 -04:00
2021-05-26 06:06:51 -04:00
void loop()
{
start = micros();
sht.read(); // default = true/fast slow = false
stop = micros();
Serial.print("\t");
Serial.print((stop - start) * 0.001);
Serial.print("\t");
Serial.print(sht.getTemperature(), 1);
Serial.print("\t");
Serial.println(sht.getHumidity(), 1);
delay(100);
}
2021-05-28 07:46:01 -04:00
2021-05-26 06:06:51 -04:00
// -- END OF FILE --