Program Error

I'm facing two problems.

Firstly, DHT Library it shows no such file in the directory.

Lastly, I can't upload the program to the micro controller.

Please assist me.

Thank you.

Help us to help you

Please follow the advice in Read this before posting a programming question then post your code and a copy of the full error message

Have you installed the DHT library and if so, where did you get it from ?

I’ve attached the codes and error message below.

Please assist me.

Thank you.

Nope. I guess you didn’t bother to read the information UKHeliBob asked you to. Posting a screenshot of a fragment of your code and a fragment of the error message is very unhelpful. We want to help you, but we can’t do it unless you provide the information we need. You’re only hurting yourself with this sort of behavior.

Please post your full sketch.

If possible, you should always post code directly in the forum thread as text using code tags:

  • Do an Auto Format (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor) on your code. This will make it easier for you to spot bugs and make it easier for us to read.
  • In the Arduino IDE or Arduino Web Editor, click on the window that contains your sketch code.
  • Press “Ctrl + A”. This will select all the text.
  • Press “Ctrl + C”. This will copy the selected text to the clipboard.
  • In a forum reply here, click the “Reply” button.
  • click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the sketch between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.
  • Repeat the above process if your sketch has multiple tabs.

This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.

If the sketch is longer than the 9000 characters maximum allowed by the forum, then it’s OK to add it as an attachment. After clicking the “Reply” button, you will see an “Attachments and other settings” link.

When your code requires a library that’s not included with the Arduino IDE please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

Please do this:

  • When you encounter an error, you’ll see a button on the right side of the orange bar “Copy error messages” in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button…
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum’s 9000 character limit, save it to a .txt file and post it as an attachment. If you click the “Reply” button here, you will see an “Attachments and other settings” link.

You also didn’t answer UKHeliBob’s question:

Have you installed the DHT library and if so, where did you get it from ?

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

I’ve attached the full sketch below.

Error message: exit status 1
expected primary-expression before ‘.’ token

Yes, i’ve installed the DHT library from DHT sensor library by Adafruit version 1.3.7 from library manager.

Please assist me.

Thank you.

Full sketch.txt (18.6 KB)

Post the FULL error message.

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

C:\Users\Khalid\Documents\Arduino\sketch_FYP\sketch_FYP.ino: In function 'void loop()':

sketch_FYP:66:25: error: expected primary-expression before '.' token

int DHT_sensorVal = DHT.read11(DHT11_Sensor); // Read DHT sensor value, assign and store the values as DHT_sensorVal.

^

sketch_FYP:67:19: error: expected primary-expression before '.' token

int DHT_Temp = DHT.temperature(); // Initialize the temperature values obtain from DHT as DHT_Temp.

^

Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\Khalid\Documents\Arduino\libraries\LiquidCrystal_I2C
Multiple libraries were found for "DHT.h"
Used: C:\Users\Khalid\Documents\Arduino\libraries\DHT_sensor_library
Not used: C:\Program
Not used: C:\Users\Khalid\Documents\Arduino\libraries\Grove_Temperature_And_Humidity_Sensor
Multiple libraries were found for "Adafruit_Sensor.h"
Used: C:\Users\Khalid\Documents\Arduino\libraries\Adafruit_Unified_Sensor
Multiple libraries were found for "Wire.h"
Used: C:\Program
exit status 1
expected primary-expression before '.' token

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

This is the full error message.

You still forgot the code tags.

Here you created a DHT object named dht:

DHT dht();

Then in the line that causes the error:

 int DHT_Temp = DHT.temperature();                           // Initialize the temperature values obtain from DHT as DHT_Temp.

You are attempting to use an object named DHT. In C++, names are case sensitive. DHT != dht. Do you see the problem now?

DHT dht();
                                                   // Creates a DHT object.

This line creates an instance of the DHT class named dht

Throughout the program you do things like this

int DHT_Temp = DHT.temperature();

which tries to use an instance named DHT

Do you see the problem ?

DHT dht();

does not create a DHT object called dht, it is a prototype for a function that takes not parameters and returns a DHT object.

DHT dht;

creates a DHT object called dht.