DHT does not name a type

Hi all,

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?

Can anyone help?

Sure. Read this. Then post your code... properly. It’s explained in paragraph 6.

PS: your declaration is backwards. Capitalization matters.
PPS: This should have been posted in programming, not general electronics.

You may install library incorrectly. See this how to install DHT sensor library

Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What model DHT are you using?
What model Arduino are you using?

Have you had a look at the Example codes for DHT library?

Tom... :slight_smile: