I am unable to sort out the error occuring in the code.I will be thank full if anyone sort's it out. The error is no such file or directory found named dht11.h.I have added libraries after then its showing the same error

#include <dht11.h>
#include <BoltDeviceCredentials.h>
#include <BoltIoT-Arduino-Helper.h>
#define DHT11PIN 7

#include <Servo.h> 
#ifndef API_KEY
#define API_KEY   "boltcloudAPI"
#endif
#ifndef DEVICE_ID
#define DEVICE_ID "boltdeviceid"
#endif

int servoPin = 3; 

Servo Servo1;
dht11 DHT11;


String getAnalogData(String *data){
  String retval="";
  retval=retval+analogRead(A1);
  return retval;
  //Serial.read();
}


String getLDR(String *data){
  String LDR="";
  LDR=LDR+analogRead(A5);
  return LDR;
}

String getRain(String *data){
  String r="";
  r=r+analogRead(A3);
  return r;
}

String getTemp(String *data){
  String value = "";
int chk = DHT11.read(DHT11PIN);
  value = value+ (int)DHT11.temperature;
  
  return value;
  }

 String getHum(String *data){
  String value = "";
int chk = DHT11.read(DHT11PIN);
 value = value+ (int)DHT11.humidity;
  
  return value;
  }


void setup () {
 
  Serial.begin (9600);
  Servo1.attach(servoPin);
  pinMode(A1,INPUT);
  pinMode(A5,INPUT);
  pinMode(A3,INPUT);

  Serial.setTimeout(500);
  boltiot.begin(Serial);
  boltiot.setCommandString("Level",getAnalogData);
  
  boltiot.setCommandString("LDR",getLDR);
  
  
  boltiot.setCommandString("Rain",getRain);

  boltiot.setCommandString("getHum",getHum);
  boltiot.setCommandString("getTemp",getTemp); 
  
  
  
  }
 
void loop() {
  
  boltiot.handleCommand();
}

You should enclose the code with specific tags.

gee… and you won’t even tell us what the error is or what your expectations are?
the code (if it compiles) does something, which is what you told it to do…

good luck getting an answer…

Sorry it’s no directory found dht11
I have tried adding libraries but thn its showing same.

please edit your post, select the code part and press the </> icon in the tool bar to mark it as code. It’s unreadable as it stands. (also make sure you indented the code in the IDE before copying, that’s done by pressing ctrlT on a PC or cmdT on a Mac)


you probably did not import the right DHT library or your IDE is not installed the right way


sir, I have tried the way you suggested. But I couldn’t resolve the error.
Sir can you please try executing once

Sir,can you please execute and check once .

Start by getting the DHT sensor to work, just using the DHT example programs.

If you still have problems after that is done, feel free to come back to the forum.

#include <dht11.h>
#include <BoltDeviceCredentials.h>
#include <BoltIoT-Arduino-Helper.h>
#define DHT11PIN 7

#include <Servo.h>
#ifndef API_KEY
#define API_KEY   "boltcloudAPI"
#endif
#ifndef DEVICE_ID
#define DEVICE_ID "boltdeviceid"
#endif

int servoPin = 3;

Servo Servo1;
dht11 DHT11;


String getAnalogData(String *data) {
  String retval = "";
  retval = retval + analogRead(A1);
  return retval;
  //Serial.read();
}


String getLDR(String *data) {
  String LDR = "";
  LDR = LDR + analogRead(A5);
  return LDR;
}

String getRain(String *data) {
  String r = "";
  r = r + analogRead(A3);
  return r;
}

String getTemp(String *data) {
  String value = "";
  int chk = DHT11.read(DHT11PIN);
  value = value + (int)DHT11.temperature;

  return value;
}

String getHum(String *data) {
  String value = "";
  int chk = DHT11.read(DHT11PIN);
  value = value + (int)DHT11.humidity;

  return value;
}


void setup () {

  Serial.begin (9600);
  Servo1.attach(servoPin);
  pinMode(A1, INPUT);
  pinMode(A5, INPUT);
  pinMode(A3, INPUT);

  Serial.setTimeout(500);
  boltiot.begin(Serial);
  boltiot.setCommandString("Level", getAnalogData);

  boltiot.setCommandString("LDR", getLDR);


  boltiot.setCommandString("Rain", getRain);

  boltiot.setCommandString("getHum", getHum);
  boltiot.setCommandString("getTemp", getTemp);



}

void loop() {

  boltiot.handleCommand();
}`Preformatted text`

can you please execute the code and sort out the issues .I have tried multiple ways and i failed badly

Please read reply #8.

What do you think this place is ? Your personal support line ?

Do your part

  • download a DHT library
  • try out one simple example without all your gears connected
  • Make sure this works before trying to do more

Come back here with details about the results of this experiment (and share links about which libraries you are using, there are tons of libraires for the DHT11)

Even if we wanted to there is no point us trying to execute your code. We don’t have the same components as you, wired and powered the same as you so why would we expect the same results?

Steve