Maker Pro
Maker Pro

Problems with code

electronicsquestions2234

Dec 22, 2017
8
Joined
Dec 22, 2017
Messages
8
Hi, people. So, I was wondering about some problems with my code and how I fix them. I am simply setting up a DHT11 with an LCD and arduino UNO. Thanks, and here is my code:

#include <DHT.h>
#include <DHT_U.h>

#include <LiquidCrystal.h>


int SENSOR = 2;

int VO = 3;
int RS = 4;
int E = 5;
int D4 = 6;
int D5 = 7;
int D6 = 8;
int D7 = 9;

int temp;
int humidity;

DHT dht (SENSOR, DHT11);
LiquidCrystal lcd (RS, E, D4, D5, D6, D7);

void setup() {
dht.begin();

lcd.begin(16, 2);
analogWrite(VO, 50); //contrast
}

void loop() {
humidity = dht.readHumidity();
temp = dht.readTemperature();

lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature: ")
lcd.print(temp);
lcd.print ("C")
lcd.setCursor(0,1);
lcd.print("Humidity: ")
lcd.print(humidity);
lcd.print(%);

delay(15000);



}
 

electronicsquestions2234

Dec 22, 2017
8
Joined
Dec 22, 2017
Messages
8
here is the entire error code: (warning: verbose output enabled)

Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"

C:\Users\Family\Desktop\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Users\Family\Desktop\Arduino\hardware -tools C:\Users\Family\Desktop\Arduino\tools-builder -tools C:\Users\Family\Desktop\Arduino\hardware\tools\avr -built-in-libraries C:\Users\Family\Desktop\Arduino\libraries -libraries C:\Users\Family\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\Family\AppData\Local\Temp\arduino_build_528632 -warnings=none -build-cache C:\Users\Family\AppData\Local\Temp\arduino_cache_17742 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\Family\Desktop\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Users\Family\Desktop\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Users\Family\Desktop\Arduino\hardware\tools\avr -verbose C:\Users\Family\Documents\Arduino\Tempandhumiditylcd\Tempandhumiditylcd.ino
C:\Users\Family\Desktop\Arduino\arduino-builder -compile -logger=machine -hardware C:\Users\Family\Desktop\Arduino\hardware -tools C:\Users\Family\Desktop\Arduino\tools-builder -tools C:\Users\Family\Desktop\Arduino\hardware\tools\avr -built-in-libraries C:\Users\Family\Desktop\Arduino\libraries -libraries C:\Users\Family\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\Family\AppData\Local\Temp\arduino_build_528632 -warnings=none -build-cache C:\Users\Family\AppData\Local\Temp\arduino_cache_17742 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\Family\Desktop\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Users\Family\Desktop\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Users\Family\Desktop\Arduino\hardware\tools\avr -verbose C:\Users\Family\Documents\Arduino\Tempandhumiditylcd\Tempandhumiditylcd.ino
Using board 'uno' from platform in folder: C:\Users\Family\Desktop\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Users\Family\Desktop\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Users\Family\Desktop\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\Family\Desktop\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\Family\Desktop\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Family\AppData\Local\Temp\arduino_build_528632\sketch\Tempandhumiditylcd.ino.cpp" -o "nul"
"C:\Users\Family\Desktop\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\Family\Desktop\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\Family\Desktop\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\Family\Documents\Arduino\libraries\DHT_sensor_library" "C:\Users\Family\AppData\Local\Temp\arduino_build_528632\sketch\Tempandhumiditylcd.ino.cpp" -o "nul"
"C:\Users\Family\Desktop\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\Family\Desktop\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\Family\Desktop\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\Family\Documents\Arduino\libraries\DHT_sensor_library" "C:\Users\Family\AppData\Local\Temp\arduino_build_528632\sketch\Tempandhumiditylcd.ino.cpp" -o "C:\Users\Family\AppData\Local\Temp\arduino_build_528632\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\Family\Documents\Arduino\Tempandhumiditylcd\Tempandhumiditylcd.ino:2:0:

C:\Users\Family\Documents\Arduino\libraries\DHT_sensor_library/DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.h>

^

compilation terminated.

Using library DHT_sensor_library at version 1.3.0 in folder: C:\Users\Family\Documents\Arduino\libraries\DHT_sensor_library
exit status 1
Error compiling for board Arduino/Genuino Uno.
 

electronicsquestions2234

Dec 22, 2017
8
Joined
Dec 22, 2017
Messages
8
The important part is this;
C:\Users\Family\Documents\Arduino\libraries\DHT_sensor_library/DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.h>

^

compilation terminated.

Using library DHT_sensor_library at version 1.3.0 in folder: C:\Users\Family\Documents\Arduino\libraries\DHT_sensor_library
exit status 1
Error compiling for board Arduino/Genuino Uno.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,608
Joined
Nov 17, 2011
Messages
12,608
The important part is this;
Sounds obvious.
Check with the windows explorer whether this directory /folder) and file exist.They may exist in another location, in that ase a copy to the expected location should suffice. Otherwise you'll have to download the library, e.g. here.
 

Bluejets

Oct 5, 2014
5,852
Joined
Oct 5, 2014
Messages
5,852
In the loop, lines 5 and 9 have incorrect syntax. .... ("Temperature ....and ..... ("Humidity ... I'll leave you to work out the rest.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,608
Joined
Nov 17, 2011
Messages
12,608
Well spotted.
Looks like there is more than one faulty spot here.
 
Top