Go Down

Topic: DHT does not name a type (Read 9235 times) previous topic - next topic

THEKNOTGUY

Getting an error message when attempting to verify an Arduido sketch code.  Don't understand why I'm getting error.

code is :=====================================
#include <DHT.h>
#define dht_apin A0 // Analog Pin sensor is connected to

dht DHT;

===========================================

Error is 'DHT' does not name a type.  Can anyone help?

CrossRoads

Likely the DHT.h library is not where it's expected to be, in your sketchbook /libraries path.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

ieee488

Getting an error message when attempting to verify an Arduido sketch code.  Don't understand why I'm getting error.

code is :=====================================
#include <DHT.h>
#define dht_apin A0 // Analog Pin sensor is connected to

dht DHT;

===========================================

Error is 'DHT' does not name a type.  Can anyone help?
I am pretty sure the Adafruit example program does not have dht DHT;



stowite

#3
Jul 15, 2016, 08:42 pm Last Edit: Jul 15, 2016, 08:45 pm by stowite
I would expect the class name to be DHT and therefore the declaration to be
Code: [Select]

DHT dht;


You need to check the class declaration in the header file.

THEKNOTGUY

Thanks for the pointers.  Will work on the issue.

SD-solar

use #define DHTPIN 2
and #define DHTTYPE DHT11
then DHT dht(DHTPIN,SHTTYPE);

DrAzzy

Are you using the same version of the DHT library that code was meant for?

I think there are two versions with the same name and different API.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up