sketch_apr13a:55: error: 'dht11' does not name a type
sketch_apr13a.ino: In function 'void setup()':
sketch_apr13a:64: error: 'DHT11LIB_VERSION' was not declared in this scope
sketch_apr13a.ino: In function 'void loop()':
sketch_apr13a:72: error: 'DHT11' was not declared in this scope
sketch_apr13a:77: error: 'DHTLIB_OK' was not declared in this scope
sketch_apr13a:80: error: 'DHTLIB_ERROR_CHECKSUM' was not declared in this scope
sketch_apr13a:83: error: 'DHTLIB_ERROR_TIMEOUT' was not declared in this scope
I think the problem is this:
Notes
To use the library, make a folder in your SKETCHBOOKPATH\libaries with the name DHT11 and put the .h and .cpp there. Optionally make a examples subdirectory to place the sample app. Be aware that the library will only be visible after restarting all instances of the Arduino IDE.
I don't exactly know what this means. I tried to copy the two codes:
dht11.h
dht11.cpp
copy paste them to Arduino 1.0.4 program and save them to my C:\Program Files\arduino-1.0.4\libraries\DHT11 folder as:
dht11.h
dht11.cpp
the files come up as "arduino source code" (dht11.h.ino) I think here is the problem, but I don't know what to do!
and then I restart the program but that doesn't help.
This is probably a real stupid question, but I don't know how to solve it.
The files are in the right directory if I understand correctly:
C:\Documents and Settings\XXX\My Documents\Arduino\libraries
I restart Arduino and c&p code from Arduino Playground - DHT11Lib to arduino.
I try to add the lib to the program from "Sketch | Import Library menu"
Try to compile and get the same error...
sketch_apr13a:56: error: 'dht11' does not name a type
sketch_apr13a.ino: In function 'void setup()':
sketch_apr13a:65: error: 'DHT11LIB_VERSION' was not declared in this scope
sketch_apr13a.ino: In function 'void loop()':
sketch_apr13a:73: error: 'DHT11' was not declared in this scope
sketch_apr13a:78: error: 'DHTLIB_OK' was not declared in this scope
sketch_apr13a:81: error: 'DHTLIB_ERROR_CHECKSUM' was not declared in this scope
sketch_apr13a:84: error: 'DHTLIB_ERROR_TIMEOUT' was not declared in this scope
The files
dht11.h
dht11.cpp
are still in dht11.h.ino format, is this right?
I Copy dht11.h code form Arduino Playground - DHT11Lib and paste to notepad, and save the file as dht11.h( before I pasted it to the Arduino IDE) in C:\Documents and Settings\XXX\My Documents\Arduino\libraries\DHT11 folder (before I used C:\Program Files\arduino-1.0.4\libraries\DHT11 folder, that was wrong your telling me)
I try to compile and NO PROBLEM, upload, all good, but the when I open serial monitor:
Most likely connected incorrectly. Post YOUR code (correctly! - read the sticky at the top of the forum) and a picture showing how the sensor is connected.
technics:
Your code says that the sensor is connected to pin #2. Could you post an actual picture of your connection?
WUHUUUUUUU!!!
Its working, I moved the cable from A0 -> 02 and I'm getting results now that seem to be correct:
Read sensor: OK
Humidity (%): 33.00
Temperature (oC): 25.00
Where did catch that pin error?
I was looking at :
double A0= 373.15/(273.15 + celsius);
but now that you pointed out my error I'm guessing what I should have been looking at is:
#define DHT11PIN 2
I have so much to learn to be able to make even the simplest of codes(I did blink the boards LED to say "hello world" in morse code, oh, the joy of it)
Really? It's NOT connected in that picture. That explains your problem!
Yeah, I changed the
Mega A0-> DHT11 out
to:
Mega D02 -> DHT11 out
and now I'm getting readings.
So whats up with:
double A0= 373.15/(273.15 + celsius);
Is it just a double named A0, and if so, why would you name it like that as it so easily could be confused...
Did I get the: #define DHT11PIN 2
right, is that where the pin is defined as D02?