mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
33 lines
578 B
C++
33 lines
578 B
C++
//
|
|
// FILE: DHT12 _plotter.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// VERSION: 0.3.0
|
|
// PURPOSE: Demo for DHT12 I2C humidity & temperature sensor
|
|
//
|
|
// HISTORY:
|
|
// 0.1.0 2020-04-11 initial version
|
|
// 0.3.0 2020-12-19 compatible new version
|
|
|
|
#include "DHT12.h"
|
|
|
|
DHT12 DHT(&Wire);
|
|
|
|
void setup()
|
|
{
|
|
DHT.begin();
|
|
Serial.begin(115200);
|
|
Serial.println("Humidity, Temperature");
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
// note no error checking
|
|
DHT.read();
|
|
Serial.print(DHT.getHumidity(), 1);
|
|
Serial.print(", ");
|
|
Serial.println(DHT.getTemperature(), 1);
|
|
delay(1000);
|
|
}
|
|
|
|
// -- END OF FILE --
|