简体   繁体   中英

DHT11 Error compiling for board Arduino/Genuino Uno

I am having a problem with is Arduino code. It is a project called the Segment LED show temperature & humidity. The Arduino board that I am using is a Uno Freaduino 2016 board. Connecting to it is a 7-segment display with 4 pins: GND, CLK, DIO, VCC and a temperature and humidity sensor to the pin analog 0 (A0).

But that part is fine it is the code. I am using the Arduino program to write it but there is an error.

The error:

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

E:\Code examples\Coding examples\Arduino\Segment_LED_Show_Temperatures_Humidity\Segment_LED_Show_Temperatures_Humidity.ino:3:19: fatal error: DHT11.h: No such file or directory

#include "DHT11.h"

       ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
 option enabled in File -> Preferences.

The code:

//variables
#include "DHT11.h"
#include "TM1637.h"
#define CLK4
#define DIO5
TM1637 tm1637(CLK, DIO);
DHT11 dht11(A0);

void setup() {
  tm1637.init();
  tm1637.set(BRIGHT_TYPICAL);
}

void loop() {
  dht11.start();
  tm1637.display(3,12);
  tm1637.display(2, (dht11.DHT11data)[2] % 10);
  tm1637.display(1, (dht11.DHT11data)[2] % 100 / 10);
  delay(1000);
  tm1637.clearDisplay();
  tm1637.display(3, (dht11.DHT11data)[0] % 10);
  tm1637.display(2, (dht11.DHT11data)[0] % 100 / 10);
  delay(1000);
}

The error:

#include "DHT11.h"

       ^

... Indicates that the specified .h file is not found.

Perhaps you need to install a DHT11 Arduino driver package .

With driver package properly installed, perhaps the line should instead be:

#include <dht11.h> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM