error in code for temperature controlled fan

jeston's picture

Offline

Joined: Jan 15, 2020

Replies: 2
error in code for temperature controlled fan
January 15, 2020 - 5:16pm

the code given by you in the following project is not executing 

https://circuitdigest.com/microcontroller-projects/automatic-temperature-controlled-fan-project

even after including all reqired libraries

please could you send me the  rectified code or tell me the errors it would be of great help

Debasis Parida's picture

Offline

Joined: Aug 22, 2019

Replies: 113
mention the error type
January 15, 2020 - 9:44pm

Hi jeston, it may be due to the inproper library.Can you please tell us the exact error showing when you compile your code.It will be better for us to recognise the error.Because code in our side is correct and working properly.

jeston's picture

Offline

Joined: Jan 15, 2020

Replies: 2
full error code
January 16, 2020 - 10:11am

heree is the full error code

 

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

sketch_jan15b:6:1: error: 'dht' does not name a type

 dht DHT;

 ^

C:\Users\CS1\Documents\Arduino\sketch_jan15b\sketch_jan15b.ino: In function 'void loop()':

sketch_jan15b:39:6: error: expected unqualified-id before '.' token

   DHT.read11(dht_dpin);

      ^

sketch_jan15b:40:15: error: expected primary-expression before '.' token

   int temp=DHT.temperature;

               ^

exit status 1
'dht' does not name a type

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

Debasis Parida's picture

Offline

Joined: Aug 22, 2019

Replies: 113
Improper Library
January 16, 2020 - 2:35pm

it is due to insertion of incorrect library..Please download the library from the link below and include it in your code.it will work.

https://drive.google.com/file/d/0B1paTI5fzcHodno5azFOSVVDT0E/view?usp=sh...

Debasis Parida's picture

Offline

Joined: Aug 22, 2019

Replies: 113
Improper dht Library
January 16, 2020 - 10:47pm

The dht library you have used is not the correct one for which the code is written.So upload the correct one.it will work

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 177
Check the dht library
January 16, 2020 - 9:18pm

Kindly check the dht header file. Hope it will work.

jeston's picture

Offline

Joined: Jan 15, 2020

Replies: 2
changed the library
January 17, 2020 - 11:21am

i changed the library according to that code but it gives the following error

sketch_jan15b:1:50: error: dht.h: No such file or directory

compilation terminated.

exit status 1
dht.h: No such file or directory

could anyone please send me a working code

 

Debasis Parida's picture

Offline

Joined: Aug 22, 2019

Replies: 113
dht.h not successfully included
January 17, 2020 - 10:14pm

It seems the new dht.h library has not been included correctly.You can do one thing, go to file->examples in Arduino IDE and then compile that.If that is compiling successfully then just edit your code as per that.Dont forgot to delete the previous dht library from this location C:\Users\Admin\Documents\Arduino\libraries.It will work.Because code is tested and working fine with us.Hope it helps!!!

Debasis Parida's picture

Offline

Joined: Aug 22, 2019

Replies: 113
Compile dht code from examples
January 17, 2020 - 10:17pm

I forgot to mention that, from file->examples, go to dht library code you have included and compile that.

Muhammad Umar's picture

Offline

Joined: Apr 09, 2020

Replies: 55
Included Library Package Issue
May 8, 2020 - 10:21pm

The code on the forum link is tested by the moderators. But there is issue with the libraries, available at different forums like on github, several libraries are available for dht, some of those are working and some of those are not working properly. If you already added a dht library, first of all remove the previous one and then go to arduino and import library which you downloaded, as there is option available for importing .zip libraries. After importing library, compile your code, hope your problem will get resolved. Here I would like to suggest you to visit SSLA and contact with the technical support team, they will support you in completion of your projects.

Technical Shahzad's picture

Offline

Joined: May 23, 2020

Replies: 48
Use Proper DHT Library from GitHub
May 26, 2020 - 1:37pm

The code on the forum link is tested by the moderators. But there is an issue with the libraries, available at different forums like on github, several libraries are available for dht, some of those are working and some of those are not working properly. If you already added a dht library, first of all remove the previous one and then go to arduino and import library which you downloaded, as there is an option available for importing .zip libraries. After importing the library, compile your code; I hope your problem will get resolved. Here I would like to suggest you to visit Sierra Software Ltd. and contact the technical support team; they will support you in completion of your projects.