mmmmm09
November 26, 2021, 3:18pm
1
I have been having an error with this code can someone help
#include <DHT.h>
#include <DHT_U.h>
#include <dht.h>
#include <LowPower.h>
#define dataPin 2
dht DHT;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN,OUTPUT);
digitalWrite(LED_BUILTIN,LOW);
}
void loop() {
Serial.println("Get Data From DHT11");
delay(1000);
digitalWrite(LED_BUILTIN,HIGH);
int readData = DHT.read11(dataPin); // DHT11
float t = DHT.temperature;
float h = DHT.humidity;
Serial.print("Temperature = ");
Serial.print(t);
Serial.print(" C | ");
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" % ");
delay(2000);
Serial.println("Arduino:- I am going for a Nap");
delay(200);
digitalWrite(LED_BUILTIN,LOW);
LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF,
SPI_OFF, USART0_OFF, TWI_OFF);
Serial.println("Arduino:- Hey I just Woke up");
Serial.println("");
delay(2000);
}
mmmmm09
November 26, 2021, 3:20pm
3
exit status 1
no matching function for call to 'DHT::DHT()'
Why three?
Please remember to use code tags when posting code
mmmmm09
November 26, 2021, 3:24pm
6
I've been having issues at first saying dht.h: no such file or directory. Then I tried searching for libraries and it disappeared, now this shows.
mmmmm09
November 26, 2021, 3:26pm
8
Arduino Sleep Modes and How to use them to Save the Power this is the project I'm working on, but having trouble with the codes
That's odd, post the code that gave you that.
mmmmm09
November 26, 2021, 3:29pm
10
Arduino Sleep Modes and How to use them to Save the Power here is the link of the project that im working, the code is there
@mmmmm09 , your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project. See
About the Installation & Troubleshooting category .
Can you please edit your opening post, select all code and click the </> button to apply code tags; next save your post.
Hi,
use this library :
and this your code:
//#include <DHT.h>
//#include <DHT_U.h>
#include <dht.h>
#include <LowPower.h>
#define dataPin 2
dht DHT;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop() {
Serial.println("Get Data From DHT11");
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
int readData = DHT.read11(dataPin); // DHT11
float t = DHT.temperature;
float h = DHT.humidity;
Serial.print("Temperature = ");
Serial.print(t);
Serial.print(" C | ");
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" % ");
delay(2000);
Serial.println("Arduino:- I am going for a Nap");
delay(200);
digitalWrite(LED_BUILTIN, LOW);
LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF,
SPI_OFF, USART0_OFF, TWI_OFF);
Serial.println("Arduino:- Hey I just Woke up");
Serial.println("");
delay(2000);
}
and tell me how it was...
RV mineirin
mmmmm09
November 29, 2021, 3:02pm
13
Thanks, there are no more code errors. However, the voltage and current being shown by the ammeter is constant even when it goes to sleep mode.
system
Closed
May 28, 2022, 3:02pm
14
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.