first commit
This commit is contained in:
commit
e6a42e28e9
4355 changed files with 4626605 additions and 0 deletions
45
libraries/DHT20/examples/DHT20_plotter/DHT20_plotter.ino
Normal file
45
libraries/DHT20/examples/DHT20_plotter/DHT20_plotter.ino
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// FILE: DHT20_plotter.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
|
||||
// URL: https://github.com/RobTillaart/DHT20
|
||||
//
|
||||
// Always check datasheet - front view
|
||||
//
|
||||
// +--------------+
|
||||
// VDD ----| 1 |
|
||||
// SDA ----| 2 DHT20 |
|
||||
// GND ----| 3 |
|
||||
// SCL ----| 4 |
|
||||
// +--------------+
|
||||
|
||||
|
||||
#include "DHT20.h"
|
||||
|
||||
DHT20 DHT(&Wire);
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin();
|
||||
DHT.begin(); // ESP32 default pins 21 22
|
||||
|
||||
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 --
|
||||
Loading…
Add table
Add a link
Reference in a new issue