GY-63_MS5611/libraries/DHT12/examples/DHT12_plotter/DHT12_plotter.ino
2021-12-16 15:58:14 +01:00

36 lines
510 B
C++

//
// FILE: DHT12 _plotter.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT12 I2C humidity & temperature sensor
//
#include "DHT12.h"
DHT12 DHT(&Wire);
void setup()
{
DHT.begin();
Serial.begin(115200);
Serial.println("Humidity, Temperature");
}
void loop()
{
if (millis() - DHT.lastRead() >= 1000)
{
// note no error checking
DHT.read();
Serial.print(DHT.getHumidity(), 1);
Serial.print(", ");
Serial.println(DHT.getTemperature(), 1);
}
}
// -- END OF FILE --