first commit
This commit is contained in:
commit
e6a42e28e9
4355 changed files with 4626605 additions and 0 deletions
104
libraries/DHT20/examples/DHT20_I2C_speed/DHT20_I2C_speed.ino
Normal file
104
libraries/DHT20/examples/DHT20_I2C_speed/DHT20_I2C_speed.ino
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
//
|
||||
// FILE: DHT20_I2C_speed.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 |
|
||||
// +--------------+
|
||||
|
||||
// NOTE datasheet states 400 KHz as maximum
|
||||
|
||||
|
||||
#include "DHT20.h"
|
||||
|
||||
DHT20 DHT;
|
||||
|
||||
uint32_t start, stop;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("DHT20 LIBRARY VERSION: ");
|
||||
Serial.println(DHT20_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Serial.println("\nNOTE: datasheet states 400 KHz as maximum.\n");
|
||||
|
||||
Wire.begin();
|
||||
DHT.begin(); // ESP32 default pins 21, 22
|
||||
delay(2000);
|
||||
|
||||
for (uint32_t speed = 50000; speed < 850000; speed += 50000)
|
||||
{
|
||||
Wire.setClock(speed);
|
||||
Serial.print(speed);
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.read()); // status
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.getHumidity(), 1);
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.getTemperature(), 1);
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
Serial.println();
|
||||
for (uint32_t speed = 50000; speed < 850000; speed += 50000)
|
||||
{
|
||||
Wire.setClock(speed);
|
||||
start = micros();
|
||||
DHT.read();
|
||||
stop = micros();
|
||||
|
||||
Serial.print(speed);
|
||||
Serial.print("\t");
|
||||
Serial.print(stop - start); // time
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.getHumidity(), 1);
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.getTemperature(), 1);
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
Serial.println();
|
||||
for (uint32_t speed = 50000; speed < 850000; speed += 50000)
|
||||
{
|
||||
DHT.requestData();
|
||||
while (DHT.isMeasuring());
|
||||
Wire.setClock(speed);
|
||||
start = micros();
|
||||
DHT.readData();
|
||||
stop = micros();
|
||||
DHT.convert();
|
||||
Serial.print(speed);
|
||||
Serial.print("\t");
|
||||
Serial.print(stop - start); // time
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.getHumidity(), 1);
|
||||
Serial.print("\t");
|
||||
Serial.print(DHT.getTemperature(), 1);
|
||||
Serial.println();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
Serial.println("\ndone...");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
Board: UNO
|
||||
IDE: 1.8.19
|
||||
|
||||
DHT20_I2C_speed.ino
|
||||
DHT20 LIBRARY VERSION: 0.2.2
|
||||
|
||||
|
||||
NOTE: datasheet states 400 KHz as maximum.
|
||||
|
||||
50000 0 48.7 17.3
|
||||
100000 0 48.7 17.3
|
||||
150000 0 48.7 17.3
|
||||
200000 0 48.6 17.3
|
||||
250000 0 48.6 17.3
|
||||
300000 0 48.6 17.3
|
||||
350000 0 48.6 17.3
|
||||
400000 0 48.6 17.3
|
||||
450000 0 48.6 17.3
|
||||
500000 0 48.6 17.3
|
||||
550000 0 48.6 17.3
|
||||
600000 0 48.6 17.3
|
||||
650000 0 48.6 17.3
|
||||
700000 0 48.6 17.3
|
||||
750000 0 48.6 17.3
|
||||
800000 0 48.6 17.3
|
||||
|
||||
50000 46916 48.6 17.4
|
||||
100000 44600 48.6 17.4
|
||||
150000 44264 48.6 17.3
|
||||
200000 43996 48.6 17.3
|
||||
250000 44308 48.6 17.3
|
||||
300000 43624 48.6 17.3
|
||||
350000 44248 48.6 17.3
|
||||
400000 44040 48.6 17.3
|
||||
450000 43724 48.5 17.4
|
||||
500000 43612 48.6 17.3
|
||||
550000 43388 48.6 17.4
|
||||
600000 43204 48.6 17.4
|
||||
650000 44200 48.6 17.3
|
||||
700000 44108 48.6 17.4
|
||||
750000 43984 48.6 17.4
|
||||
800000 43984 48.5 17.4
|
||||
|
||||
50000 1576 48.6 17.3
|
||||
100000 836 48.6 17.4
|
||||
150000 588 48.5 17.3
|
||||
200000 472 48.6 17.4
|
||||
250000 400 48.5 17.3
|
||||
300000 336 48.6 17.4
|
||||
350000 296 48.6 17.4
|
||||
400000 284 48.6 17.3
|
||||
450000 252 48.6 17.4
|
||||
500000 244 48.6 17.3
|
||||
550000 228 48.6 17.4
|
||||
600000 216 48.6 17.3
|
||||
650000 204 48.6 17.3
|
||||
700000 200 48.5 17.4
|
||||
750000 188 48.6 17.4
|
||||
800000 188 48.6 17.4
|
||||
|
||||
done...
|
||||
Loading…
Add table
Add a link
Reference in a new issue