markruys / arduino-dht Goto Github PK
View Code? Open in Web Editor NEWEfficient DHT library for Arduino
License: Other
Efficient DHT library for Arduino
License: Other
hi, so im working on an school project for my exam with an Arduino Uno, and ive got an lcd display and an DHT11 but im getting this error:
DHT-22:12:51: error: no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(int, int, int, int, int, int, int, int, int)'
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3);
^
In file included from C:\Users\merij\Downloads\DHT-22\DHT-22.ino:9:0:
C:\Users\merij\OneDrive\Documents\Arduino\libraries\LiquidCrystal_I2C-1.1.2/LiquidCrystal_I2C.h:57:3: note: candidate: LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, uint8_t)
LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);
^~~~~~~~~~~~~~~~~
C:\Users\merij\OneDrive\Documents\Arduino\libraries\LiquidCrystal_I2C-1.1.2/LiquidCrystal_I2C.h:57:3: note: candidate expects 3 arguments, 9 provided
C:\Users\merij\OneDrive\Documents\Arduino\libraries\LiquidCrystal_I2C-1.1.2/LiquidCrystal_I2C.h:55:7: note: candidate: constexpr LiquidCrystal_I2C::LiquidCrystal_I2C(const LiquidCrystal_I2C&)
class LiquidCrystal_I2C : public Print {
^~~~~~~~~~~~~~~~~
C:\Users\merij\OneDrive\Documents\Arduino\libraries\LiquidCrystal_I2C-1.1.2/LiquidCrystal_I2C.h:55:7: note: candidate expects 1 argument, 9 provided
C:\Users\merij\OneDrive\Documents\Arduino\libraries\LiquidCrystal_I2C-1.1.2/LiquidCrystal_I2C.h:55:7: note: candidate: constexpr LiquidCrystal_I2C::LiquidCrystal_I2C(LiquidCrystal_I2C&&)
C:\Users\merij\OneDrive\Documents\Arduino\libraries\LiquidCrystal_I2C-1.1.2/LiquidCrystal_I2C.h:55:7: note: candidate expects 1 argument, 9 provided
DHT-22:13:1: error: 'dht' does not name a type
dht DHT;
^~~
C:\Users\merij\Downloads\DHT-22\DHT-22.ino: In function 'void loop()':
DHT-22:18:21: error: expected primary-expression before '.' token
int readData = DHT.read11(dataPin);
^
DHT-22:19:16: error: expected primary-expression before '.' token
float t = DHT.temperature;
^
DHT-22:20:16: error: expected primary-expression before '.' token
float h = DHT.humidity;
^
These are the Library's that i've got installed.
Generally it's good practice avoid naming your library the same way as other well known libraries, I'd suggest changing from the library name from DHT to something else to maximize compatibility. Some users of your library assumed compatibility with the adafruit DHT library, which could have been avoided.
No matching function call DHT:DHT().
I do not know what else to say except adafruit dht lib is already installed and not able to work.
hi, so i'm making an project for school, and I am trying to display the information of an DHT11 to an 16x2 LCD display (1602).
but its only displaying an Q although i dont have an q as lcd.print in my code.
`//hier importeren we de juiste librarys
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <DHT.h>
//hier laten we het programma weten wat het I2C adres
//is en dat het een 16 bij 2 beeldscherm is
LiquidCrystal_I2C lcd(0x27,20,4);
#define DHTPIN 7 // Digital pin connected to the DHT sensor
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
#define DHT11_PIN 7
void setup(){
lcd.begin(16, 2);
//hier initializeren we de lampjes van
//het beeldscherm het is belangrijk dat je 2 keer
//lcd.init() hebt wantanders werkt je programma niet
lcd.on();
//lcd.on();
lcd.backlight();
}
void loop()
{
int chk = dht.read(DHT11_PIN);
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(dht.readTemperature());
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("Humi: %");
lcd.print(dht.readHumidity());
delay(2000);
How can I disable the timeout 'nan' display?
I used it with an ESP32 and DHT22 and it works wonders! Much easier to use than the Adafruit library.
When compiled for ESP8266, this library functions return some strange readings like:
Temperature: 3080214.00 *C
Humidity: 404527.00 %
Hello!
Am using example for this library.
Am getting age == 92
here https://github.com/markruys/arduino-DHT/blob/master/DHT.cpp#L149
Changing condition to be age > 92
doesn't solve eternal TIMEOUTs.
What can be wrong?
TIA,
--Vladimir
See below - this is the output I get using the example sketch with a DHT22 connected.
Each blank line indicates when I've pressed the reset button on the Arduino.
NB I'm using a modified version of the example sketch that checks dht.getModel()
after dht.setup()
is called - see liwenyip@ff1c976
Auto-detected DHT11
Status Humidity (%) Temperature (C) (F)
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
Auto-detected DHT22
Status Humidity (%) Temperature (C) (F)
OK 54.4 27.8 82.0
OK 54.2 27.8 82.0
OK 54.7 27.8 82.0
Auto-detected DHT11
Status Humidity (%) Temperature (C) (F)
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
Auto-detected DHT22
Status Humidity (%) Temperature (C) (F)
OK 54.7 27.8 82.0
OK 54.5 27.8 82.0
OK 54.8 27.8 82.0
OK 54.7 27.8 82.0
OK 54.6 27.8 82.0
Auto-detected DHT22
Status Humidity (%) Temperature (C) (F)
OK 54.7 27.8 82.0
OK 55.0 27.8 82.0
Auto-detected DHT22
Status Humidity (%) Temperature (C) (F)
OK 55.0 27.8 82.0
OK 54.5 27.8 82.0
Auto-detected DHT22
Status Humidity (%) Temperature (C) (F)
OK 54.9 27.8 82.0
OK 54.9 27.8 82.0
OK 54.8 27.8 82.0
OK 54.3 27.9 82.2
Auto-detected DHT11
Status Humidity (%) Temperature (C) (F)
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
OK 2.0 1.0 33.8
Auto-detected DHT22
Status Humidity (%) Temperature (C) (F)
OK 54.3 27.9 82.2
OK 54.0 28.0 82.4
OK 53.9 28.0 82.4
All,
used the example code and every once and a while the reported values go from normal to some low value
Normal = 24 C and 40%
Low Value = 0 C and 1%
Any idea why ?
Sometimes the DHT22 doesnt work properly and doesnt give the right Temp. Is there a way to get a feedback whether the sensor is working properly or not?
I have been using two DHT11s and the library that is specific to the DHT11 allows for specifying each sensor with a specific pin.
Can I do this with this new library using two DHT22s?
Thanks
Bruce
Why are you testing for < 1999 rather than < 2000 here:
if ( (unsigned long)(startTime - lastReadTime) < (model == DHT11 ? 999L : 1999L) ) {
return;
}
Are you assuming that the overhead of calling the function will be 1ms, such that the duty cycle of 2000ms is maintained?
When including the library as .zip file, an error occurs like Zip doesn't contain a library. I have been using your library everytime I use DHT11. Kindly solve the bug..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.