Pages: [1] 2   Go Down
Author Topic: Help with DHT11  (Read 4669 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to get my dht11 sensor up and running.  I am using the library and example from http://stigern.net/blog/?p=373 on arduino 1.o and am having an issue.  It tells me that "dht11 does not name a type".  Help.  Is there something wrong.  I have checked that the library was uploaded right.  Is it a bad library?  Is there a better one?
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14048
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


At least there is another one -  http://arduino.cc/playground/Main/DHTLib -
You can test yourself if it better suits your needs.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just tried the link you gave me.  Replaced the .ccp and .h then used the sketch provided.  It still says the same error.
code line: dht11 DHT11;
error: 'dht11' does not name a type

ideas?
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14048
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How and where did you install the library?

Which version of the IDE are you using?



Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I installed the library in the library folder, just like I did for my Dallas OneWires and have had no issue with them reading the library. I installed it by downloading the .zip file to the library folder then extracting the file to the same location.  The dht library folder contains the .h .ccp and example.  The library shows up in the IDE examples and can load the example sketch, but the example sketch shows the error previously listed.

 I am running IDE version 1.0
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try opening a new file, copy and paste your existing code into the new file, then try and compile.

I had the same issue with Easy Transfer on a file that had worked in the past and the copy and paste did the trick for me.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Copy and paste did work!  I now need to get the code to calculate dew, convert the temp to F and get evevrything to return whole numbers only.  I am hoping to have my dht11 and my dallas onewires both integrated tonight.  I can get the dht11 to print to the lcd and separately get the onewire to print to lvd, but can't get them both to print.
Logged

Belgium
Offline Offline
Sr. Member
****
Karma: 1
Posts: 283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Copy and paste did work!  I now need to get the code to calculate dew, convert the temp to F and get evevrything to return whole numbers only.  I am hoping to have my dht11 and my dallas onewires both integrated tonight.  I can get the dht11 to print to the lcd and separately get the onewire to print to lvd, but can't get them both to print.

Have a look at this -> http://arduino-info.wikispaces.com/TemperatureHumidity there some code there that will be helpful smiley
Logged


Northern Ontario, Canada
Offline Offline
Newbie
*
Karma: 2
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Give this a try:

Code:
//
//   FILE:  dht_test.pde
// PURPOSE: DHT library test sketch for Arduino
//
// From left to right
// 1 : VCC (5V)
// 2 : SIGnal
// 3 : NC Not connected
// 4 : GND

#include <dht.h>

dht DHT;

#define DHT11_PIN 4


void setup()
{
  Serial.begin(9600);
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT_LIB_VERSION);
  Serial.println();
  Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}

void loop()
{
  printTemp();
  delay(1000);
}

void printTemp(){
   // READ DATA
  Serial.print("DHT11, \t");
  int chk = DHT.read11(DHT11_PIN);
  switch (chk)
  {
    case 0:  Serial.print("OK,\t"); break;
    case -1: Serial.print("Checksum error,\t"); break;
    case -2: Serial.print("Time out error,\t"); break;
    default: Serial.print("Unknown error,\t"); break;
  }
 // DISPLAT DATA
  Serial.print(DHT.humidity,1);
  Serial.print(",\t");
  Serial.println(DHT.temperature,1);
}


//
// END OF FILE
//

Logged

Deventer
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the same problem.....


https://picasaweb.google.com/lh/photo/rbsdks-ALfyU-FFVgMU859MTjNZETYmyPJy0liipFm0?feat=directlink

did the steps above, but with no results.

What is wrong? Can somebody help me?

Grtx,

Marcel
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14048
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


you must first install the library and then open the IDE. The IDE reads a list of libs during startup and ignores the ones installed when it is running.

tried this one - -  http://arduino.cc/playground/Main/DHTLib -  It explains how to install the lib ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Deventer
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Rob,

Yes i followed the website.... My sketchbook path is not in programfiles, so i even tried to copy the lib folder to the sketchbook folder. But that doesn't work also.

I really don't know what i am doing wrong.

AAhhhhhh
Logged

Deventer
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This error i get:
sketch_mar17a.cpp:6:17: error: dht.h: No such file or directory
sketch_mar17a:7: error: 'dht' does not name a type
sketch_mar17a.cpp: In function 'void setup()':
sketch_mar17a:17: error: 'DHT_LIB_VERSION' was not declared in this scope
sketch_mar17a.cpp: In function 'void loop()':
sketch_mar17a:26: error: 'DHT' was not declared in this scope

Logged

Deventer
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think i have a problem with the paths on my laptop.

This is the error i get now!

In file included from DHT11.cpp:8:
C:\Program Files (x86)\arduino-1.0\libraries\DHT11/dht11.h:19:22: error: WProgram.h: No such file or directory

Logged

Deventer
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay i found this link on a dif forum:
http://nootropicdesign.com/forum/viewtopic.php?t=2434

the include for Wprogram.h is compatible with Arduino1.0???? You must include arduin.h ??
Weird.....

But it works now!

Logged

Pages: [1] 2   Go Up
Jump to: