mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
41 lines
726 B
Arduino
41 lines
726 B
Arduino
|
//
|
||
|
// FILE: SHT31_lastRead.ino
|
||
|
// AUTHOR: Rob Tillaart
|
||
|
// VERSION: 0.0.1
|
||
|
// PURPOSE: demo
|
||
|
//
|
||
|
// HISTORY:
|
||
|
|
||
|
#include "Wire.h"
|
||
|
#include "SHT31.h"
|
||
|
|
||
|
uint32_t start;
|
||
|
uint32_t stop;
|
||
|
|
||
|
SHT31 sht;
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
Serial.begin(115200);
|
||
|
Serial.println(__FILE__);
|
||
|
Serial.print("SHT31_LIB_VERSION: \t");
|
||
|
Serial.println(SHT31_LIB_VERSION);
|
||
|
|
||
|
Wire.begin();
|
||
|
sht.begin(0x44);
|
||
|
Wire.setClock(100000);
|
||
|
uint16_t stat = sht.readStatus();
|
||
|
Serial.print(stat, HEX);
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
sht.read(); // default = true/fast slow = false
|
||
|
Serial.print("\t");
|
||
|
Serial.print(sht.lastRead());
|
||
|
Serial.print("\t");
|
||
|
Serial.print(sht.temperature, 1);
|
||
|
Serial.print("\t");
|
||
|
Serial.println(sht.humidity, 1);
|
||
|
delay(100);
|
||
|
}
|