mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
33 lines
525 B
C++
33 lines
525 B
C++
//
|
|
// FILE: DHT12 _plotter.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// VERSION: 0.1.0
|
|
// PURPOSE: Demo for DHT12 I2C humidity & temperature sensor
|
|
//
|
|
// HISTORY:
|
|
// 0.1.0 - 2020-04-11 initial version
|
|
//
|
|
|
|
#include <DHT12.h>
|
|
|
|
DHT12 DHT;
|
|
|
|
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 --
|