Problem with DHT22 & Due

Our range of tiny modules are designed to make it easy for you to quickly add functionality to your projects. [Module List]
Post Reply
hawkinsrl
Posts: 2
Joined: Wed Sep 02, 2015 3:23 pm

Problem with DHT22 & Due

Post by hawkinsrl » Wed Sep 02, 2015 3:30 pm

Hi all:
I have a DHT22, which works fine when used with my Uno on Pin 7. However, when I try to compile for my Due, I get the following errors:


Arduino: 1.6.5 (Windows 7), Board: "Arduino Due (Programming Port)"

Build options changed, rebuilding all

Using library DHT-sensor-library in folder: C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library (legacy)



C:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=10605 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due" -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/libsam -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/CMSIS/CMSIS/Include/ -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/CMSIS/Device/ATMEL/ -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\variants\arduino_due_x -IC:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library C:\Users\RE6C6~1.LEE\AppData\Local\Temp\build1415786565330140346.tmp\DHTtester.cpp -o C:\Users\RE6C6~1.LEE\AppData\Local\Temp\build1415786565330140346.tmp\DHTtester.cpp.o

C:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=10605 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due" -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/libsam -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/CMSIS/CMSIS/Include/ -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/CMSIS/Device/ATMEL/ -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\variants\arduino_due_x -IC:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library -IC:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library\utility C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library\DHT.cpp -o C:\Users\RE6C6~1.LEE\AppData\Local\Temp\build1415786565330140346.tmp\DHT-sensor-library\DHT.cpp.o

C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library\DHT.cpp: In member function 'boolean DHT::read()':
C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library\DHT.cpp:109:7: error: 'cli' was not declared in this scope
cli();
^
C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\DHT-sensor-library\DHT.cpp:139:7: error: 'sei' was not declared in this scope
sei();
^
Error compiling.



Any ideas?

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: Problem with DHT22 & Due

Post by andrew » Thu Sep 03, 2015 4:44 am

The DHT library needs to be rewritten to work with the Due (thanks to the different micrcontroller etc).
Try Rob's library from:
http://forum.arduino.cc/index.php/topic,58531.0.html

hawkinsrl
Posts: 2
Joined: Wed Sep 02, 2015 3:23 pm

Re: Problem with DHT22 & Due

Post by hawkinsrl » Wed Sep 09, 2015 10:11 pm

johnb wrote:The DHT library needs to be rewritten to work with the Due (thanks to the different micrcontroller etc).
Try Rob's library from:
http://forum.arduino.cc/index.php/topic,58531.0.html
Thanks, that did the trick. I did, however, have to comment all references to his "stat" struct, otherwise I got the following errors:

Arduino: 1.6.5 (Windows 7), Board: "Arduino Due (Programming Port)"

Using library dht in folder: C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\dht (legacy)



C:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=10605 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due" -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/libsam -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/CMSIS/CMSIS/Include/ -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\system/CMSIS/Device/ATMEL/ -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino -IC:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\variants\arduino_due_x -IC:\Users\R. Lee Hawkins\Documents\Arduino\libraries\dht C:\Users\RE6C6~1.LEE\AppData\Local\Temp\build6689820628615841086.tmp\dht22_test.cpp -o C:\Users\RE6C6~1.LEE\AppData\Local\Temp\build6689820628615841086.tmp\dht22_test.cpp.o

dht22_test.ino:28:3: error: '<anonymous struct> stat' redeclared as different kind of symbol
In file included from c:\users\r. lee hawkins\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdlib.h:11:0,
from C:\Users\R. Lee Hawkins\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino/Arduino.h:24,
from C:\Users\R. Lee Hawkins\Documents\Arduino\libraries\dht/dht.h:18,
from dht22_test.ino:15:
c:\users\r. lee hawkins\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\sys\stat.h:150:5: error: previous declaration of 'int stat(const char*, stat*)'
int _EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf ));
^
dht22_test.ino: In function 'void loop()':
dht22_test.ino:49:10: error: request for member 'total' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:53:14: error: request for member 'ok' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:57:14: error: request for member 'crc_error' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:61:14: error: request for member 'time_out' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:65:14: error: request for member 'unknown' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:77:14: error: request for member 'total' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:80:25: error: request for member 'total' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:82:25: error: request for member 'ok' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:84:25: error: request for member 'crc_error' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:86:25: error: request for member 'time_out' in 'stat', which is of non-class type 'int(const char*, stat*)'
dht22_test.ino:88:25: error: request for member 'unknown' in 'stat', which is of non-class type 'int(const char*, stat*)'
'<anonymous struct> stat' redeclared as different kind of symbol

Post Reply