GY-63_MS5611/libraries/SHT31/examples/SHT31_lastRead/SHT31_lastRead.ino

51 lines
886 B
Arduino
Raw Normal View History

2019-02-18 08:01:41 -05:00
//
// FILE: SHT31_lastRead.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
2020-11-27 05:33:55 -05:00
// URL: https://github.com/RobTillaart/SHT31
2019-02-18 08:01:41 -05:00
2021-05-28 07:45:10 -04:00
2019-02-18 08:01:41 -05:00
#include "Wire.h"
#include "SHT31.h"
2021-01-29 06:31:58 -05:00
#define SHT31_ADDRESS 0x44
2019-02-18 08:01:41 -05:00
uint32_t start;
uint32_t stop;
2023-12-09 11:38:29 -05:00
SHT31 sht(SHT31_ADDRESS, &Wire); // use explicit address and Wire
2019-02-18 08:01:41 -05:00
2021-05-28 07:45:10 -04:00
2019-02-18 08:01:41 -05:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("SHT31_LIB_VERSION: \t");
Serial.println(SHT31_LIB_VERSION);
Wire.begin();
Wire.setClock(100000);
2023-12-09 11:38:29 -05:00
sht.begin();
2020-11-27 05:33:55 -05:00
2019-02-18 08:01:41 -05:00
uint16_t stat = sht.readStatus();
Serial.print(stat, HEX);
2020-11-27 05:33:55 -05:00
Serial.println();
2019-02-18 08:01:41 -05:00
}
2021-05-28 07:45:10 -04:00
2019-02-18 08:01:41 -05:00
void loop()
{
2023-12-09 11:38:29 -05:00
sht.read(); // default = true/fast slow = false
2019-02-18 08:01:41 -05:00
Serial.print("\t");
Serial.print(sht.lastRead());
Serial.print("\t");
2020-11-27 05:33:55 -05:00
Serial.print(sht.getTemperature(), 1);
2019-02-18 08:01:41 -05:00
Serial.print("\t");
2020-11-27 05:33:55 -05:00
Serial.println(sht.getHumidity(), 1);
2019-02-18 08:01:41 -05:00
delay(100);
2020-11-27 05:33:55 -05:00
}
2021-05-28 07:45:10 -04:00
2023-12-09 11:38:29 -05:00
// -- END OF FILE --
2021-12-28 06:31:55 -05:00