Pages: [1]   Go Down
Author Topic: DHT 22 Example in Arduino 1.0.3 not working  (Read 1043 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!
DHT 22 Example in Arduino 1.0.3 not working.
when I replaced in DHT22.cpp #include "WProgram.h" with #include "Arduino.h", I received this:
Code:
In file included from D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/Arduino.h:192,
                 from D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\libraries\DHT22\DHT22.cpp:47:
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:116: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const char*)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:115: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:117: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:116: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const char*)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:118: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:117: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, char)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:119: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, int)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:118: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:120: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:119: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, int)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:121: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long int)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:120: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:122: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long unsigned int)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/WString.h:121: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, long int)' here
In file included from D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\libraries\DHT22\DHT22.cpp:47:
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/Arduino.h:196: error: declaration of C function 'uint16_t makeWord(byte, byte)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/Arduino.h:195: error: previous declaration 'uint16_t makeWord(uint16_t)' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/Arduino.h:206: error: declaration of C function 'long int random(long int)' conflicts with
d:/mdata/dropbox/ardoino/arduino-1.0.3-windows/arduino-1.0.3/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:504: error: previous declaration 'long int random()' here
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/Arduino.h:207: error: declaration of C function 'long int random(long int, long int)' conflicts with
D:\MData\Dropbox\Ardoino\arduino-1.0.3-windows\arduino-1.0.3\hardware\arduino\cores\arduino/Arduino.h:206: error: previous declaration 'long int random(long int)' here
Can anyone help me to correct the error?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 643
Posts: 50443
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The fact that the code fails to compile makes it pretty obvious that it isn't going to work. So, your thread title is wrong. It isn't that the code isn't working, as in producing the desired results.

User downloaded libraries do NOT go in the same folder with core libraries. Go back to the library page and learn where you are supposed to put user-downloaded libraries.

While you are at it, post a link to where you downloaded the library from, so we can reproduce your issue. Since you changed what you downloaded, you probably should post those changes, too.
Logged

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

I installed the library following the  instructions in the library page, but nothing changed. the code did not compile. I downloaded the library from: https://github.com/nethoncho/Arduino-DHT22
Thanks for the help
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 643
Posts: 50443
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What changes did you make after downloading the library? I removed the #include statement that tried to include WConstants.h, and added a #include "Arduino.h" (outside the extern block), and the example compiled just fine.
Logged

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

I changed "WProgram.h" with # include "Arduino.h", but I did not know it had to be outside the extern block.
Now the code is compiled. After a few days I'll know if it works when I load it in the Arduino.  smiley-red
Мany thanks for your help!
Logged

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

It works great! Thanks for your help!
Logged

Pages: [1]   Go Up
Jump to: