error in code for temperature controlled fan

Submitted by jeston on

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

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.

  Joined August 22, 2019      125
Thursday at 12:29 PM

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.

  Joined January 15, 2020      2
Wednesday at 05:09 PM

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=s…

  Joined August 22, 2019      125
Thursday at 12:29 PM

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

  Joined August 22, 2019      125
Thursday at 12:29 PM

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

  Joined February 12, 2018      696
Monday at 02:11 PM

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

 

  Joined January 15, 2020      2
Wednesday at 05:09 PM

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!!!

  Joined August 22, 2019      125
Thursday at 12:29 PM

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

  Joined August 22, 2019      125
Thursday at 12:29 PM

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.

  Joined April 09, 2020      55
Thursday at 02:40 PM

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.

  Joined May 23, 2020      47
Saturday at 02:49 PM