Not trying to send Temperature Alert Using DHT 11 using GSM 900A mini

Iam using this code …Also Iam using Arduino Mega
But it gets error and says DHT11 was not declared in this scope and
#define DHTTYPE DHT11

#include <SoftwareSerial.h>

#include<LiquidCrystal.h>
#include <DHT.h>

LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
SoftwareSerial mySerial(2, 3);

#define DHTPIN 4 // what pin we’re connected to
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

float temp_read, Temp_alert_val, Temp_shut_val;
int sms_count = 0, Fire_Set;

void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
lcd.begin(16, 2);
dht.begin();
delay(500);
}

void loop()
{
CheckFire();
CheckShutDown();
}

void CheckFire()
{
int hum = dht.readHumidity();
int temp = dht.readTemperature();

lcd.setCursor(0, 0);
lcd.print(“T: “);
lcd.print(temp);
lcd.print(”\337C”);
lcd.print(" - H: “);
lcd.print(hum);
lcd.print(”%");
delay(200);
Temp_alert_val = CheckTemp();
if (Temp_alert_val > 32)
{
SetAlert(); // Function to send SMS Alerts
}
}

float CheckTemp()
{
// temp_read = analogRead(sensor); // reads the sensor output (Vout of LM35)
// temp_read = temp_read * 5; // converts the sensor reading to temperature
// temp_read = temp_read / 10; // adds the decimal point
//return temp_read; // returns temperature value in degree celsius
int temp = dht.readTemperature();
temp_read = (temp);
}

void SetAlert()
{
while (sms_count < 3) //Number of SMS Alerts to be sent
{
SendTextMessage(); // Function to send AT Commands to GSM module
}
Fire_Set = 1;
lcd.setCursor(0, 1);
lcd.print(“High Temp! SMS Sent!”);
}

void CheckShutDown()
{
if (Fire_Set == 1)
{

Temp_shut_val = CheckTemp();
if (Temp_shut_val < 28)
{
lcd.setCursor(0, 1);
lcd.print(“Temp Normal! SAFE NOW”);
sms_count = 0;
Fire_Set = 0;
}
}
}

void SendTextMessage()
{
int hum = dht.readHumidity();
int temp = dht.readTemperature();

lcd.setCursor(0, 0);
lcd.print(“T: “);
lcd.print(temp);
lcd.print(”\337C”);
lcd.print(" - H: “);
lcd.print(hum);
lcd.print(”%");
delay(200);
mySerial.println(“AT+CMGF=1”); //To send SMS in Text Mode
delay(2000);
mySerial.println(“AT+CMGS=”+91xxxxxxxxxx"\r"); // change to the phone number you using
delay(2000);
mySerial.println(“Alert !! Temperature:”);
mySerial.print(temp);
mySerial.print("\337C and Humidity:");
mySerial.print(hum);
mySerial.print(" %. Temp is above set threshold!");//the content of the message
delay(200);
mySerial.println((char)26);//the stopping character
delay(5000);
mySerial.println(“AT+CMGS=”+91xxxxxxxxxx"\r"); // change to the phone number you using
delay(2000);
mySerial.println(“Alert !! Temp is above set threshold!”);//the content of the message
delay(200);
mySerial.println((char)26);//the message stopping character
delay(5000);
sms_count++;
}

I have a sneaky suspicion it's dht.h lowercase not DHT.h

edit.... yep I tested an old sketch of mine which compiles with dht but not DHT in the include.

JimboZA:
I have a sneaky suspicion it’s dht.h lowercase not DHT.h
edit… yep I tested an old sketch of mine which compiles with dht but not DHT in the include.

Jim, I just did a quick search and found multiple DHT libraries, some with “dht.h” and others with “DHT.h”, so it depends on exactly which one jazzytech is using. (The one from adafruit is “DHT.h”)

@jazzytech, I just tested your code, using the DHT library from adafruit, and compiling for a Mega2560 using IDE V1.6.5, and it compiled fine without errors.

Edit: This is the library I used:- DHT-sensor-library

Edit2: Almost forgot. @jazzytech, in the future could you please use [code]code tags[/code] when posting code, rather than posting it inline. You can type them manually, or select your code then press the </> button in the “Reply” window.
It stops your code being corrupted with smilies or turning to italics, (which luckily didn’t happen in this instance), and also makes it much easier to read or to select and copy into an IDE for testing. Thanks. :slight_smile:
(It’s not to late to edit and do that now, actually, for the benefit of anyone else who reads this thread.)

OldSteve:
Jim, I just did a quick search and found multiple DHT libraries, some with "dht.h" and others with "DHT.h", so it depends on exactly which one jazzytech is using. (The one from adafruit is "DHT.h")

10-4