Mysensor "humiditysensor sketch" error compiling when verifying

Hi,

I am getting a error compiling when I verify the Mysensor "humiditysensor sketch".

All other My sensor sketches verify without a problem.

I have copy & pasted into arduino 1.6.3 with no changes.

The error compiling message comes up, but gives me no other information. the window is black.

Has any one else had problems with this sketch or knows the reason.

Thanks Jamie :confused:

Update found error message when I opened the ide to full page.

Not being a programmer it means little to me.Here it is.

Arduino: 1.6.3 (Windows 7), Board: "Arduino Nano, ATmega328"

Using library SPI in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI 

Using library MySensors in folder: C:\Program Files (x86)\Arduino\libraries\MySensors (legacy)

Using library DHT sensor library in folder: C:\Users\User\Documents\Arduino\libraries\DHT_sensor_library 



C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10603 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Program Files (x86)\Arduino\libraries\MySensors -IC:\Users\User\Documents\Arduino\libraries\DHT_sensor_library C:\Users\User\AppData\Local\Temp\build5578486552940611179.tmp\HumiditySensor.cpp -o C:\Users\User\AppData\Local\Temp\build5578486552940611179.tmp\HumiditySensor.cpp.o 

HumiditySensor.ino:11:5: error: no matching function for call to 'DHT::DHT()'

HumiditySensor.ino:11:5: note: candidates are:

In file included from HumiditySensor.ino:3:0:

C:\Users\User\Documents\Arduino\libraries\DHT_sensor_library/DHT.h:31:3: note: DHT::DHT(uint8_t, uint8_t, uint8_t)

   DHT(uint8_t pin, uint8_t type, uint8_t count=6);

   ^

C:\Users\User\Documents\Arduino\libraries\DHT_sensor_library/DHT.h:31:3: note:   candidate expects 3 arguments, 0 provided

C:\Users\User\Documents\Arduino\libraries\DHT_sensor_library/DHT.h:23:7: note: DHT::DHT(const DHT&)

 class DHT {

       ^

C:\Users\User\Documents\Arduino\libraries\DHT_sensor_library/DHT.h:23:7: note:   candidate expects 1 argument, 0 provided

HumiditySensor.ino: In function 'void setup()':

HumiditySensor.ino:22:7: error: 'class DHT' has no member named 'setup'

HumiditySensor.ino: In function 'void loop()':

HumiditySensor.ino:36:13: error: 'class DHT' has no member named 'getMinimumSamplingPeriod'

HumiditySensor.ino:38:27: error: 'class DHT' has no member named 'getTemperature'

HumiditySensor.ino:44:25: error: 'class DHT' has no member named 'toFahrenheit'

HumiditySensor.ino:51:24: error: 'class DHT' has no member named 'getHumidity'

Error compiling.

I guess my problem is in the dht_sensor _library file but have no way of knowing how to
fix it

Thanks Jamie

The code you are using would help.

Please put your code in its own window as seen in other posts. This can be done by placing     [code] and [/code]  around the code. This makes it easier for others to read.

Weedpharma

I don't know whether I am right or not but I think it says that it couldn't find the functions and they are located in the library files. As you said you don't know how to fix it, if it is like this, just reinstall the library. It might work... Weird otherwise.

Hi,

I have just reinstalled the library, but end up with exactly the same message.

Could this be an error in the sketch itself.

Thanks Jamie

Hence my request for the code.

Weedpharma

Sorry Weedpharma I thought you were refering to original post, to enclose with code tags.

Here is the humidity sensor sketch which comes straight from the Mysensor files without change.

#include <SPI.h>
#include <MySensor.h>  
#include <DHT.h>  

#define CHILD_ID_HUM 0
#define CHILD_ID_TEMP 1
#define HUMIDITY_SENSOR_DIGITAL_PIN 3
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

MySensor gw;
DHT dht;
float lastTemp;
float lastHum;
boolean metric = true; 
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);


void setup()  
{ 
  gw.begin();
  dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 

  // Send the Sketch Version Information to the Gateway
  gw.sendSketchInfo("Humidity", "1.0");

  // Register all sensors to gw (they will be created as child devices)
  gw.present(CHILD_ID_HUM, S_HUM);
  gw.present(CHILD_ID_TEMP, S_TEMP);
  
  metric = gw.getConfig().isMetric;
}

void loop()      
{  
  delay(dht.getMinimumSamplingPeriod());

  float temperature = dht.getTemperature();
  if (isnan(temperature)) {
      Serial.println("Failed reading temperature from DHT");
  } else if (temperature != lastTemp) {
    lastTemp = temperature;
    if (!metric) {
      temperature = dht.toFahrenheit(temperature);
    }
    gw.send(msgTemp.set(temperature, 1));
    Serial.print("T: ");
    Serial.println(temperature);
  }
  
  float humidity = dht.getHumidity();
  if (isnan(humidity)) {
      Serial.println("Failed reading humidity from DHT");
  } else if (humidity != lastHum) {
      lastHum = humidity;
      gw.send(msgHum.set(humidity, 1));
      Serial.print("H: ");
      Serial.println(humidity);
  }

  gw.sleep(SLEEP_TIME); //sleep a bit
}

Thanks Jamie

Using library MySensors in folder: C:\Program Files (x86)\Arduino\libraries\MySensors (legacy)
Using library DHT sensor library in folder: C:\Users\User\Documents\Arduino\libraries\DHT_sensor_library

You have the MySensors library installed in the wrong place. Move:
C:\Program Files (x86)\Arduino\libraries\MySensors
to
C:\Users\User\Documents\Arduino\libraries\MySensors

It also makes more sense to call the folder "MySensor" to match the "MySensor.h" file.

I have moved Mysensor folder & still getting error as below.

Arduino: 1.6.3 (Windows 7), Board: "Arduino Nano, ATmega328"

Using library SPI in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI 

Using library MySensor in folder: C:\Users\User\Documents\Arduino\libraries\MySensor (legacy)

Using library DHT in folder: C:\Users\User\Documents\Arduino\libraries\DHT (legacy)



C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10603 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Users\User\Documents\Arduino\libraries\MySensor -IC:\Users\User\Documents\Arduino\libraries\DHT C:\Users\User\AppData\Local\Temp\build7724510199007360408.tmp\HumiditySensor.cpp -o C:\Users\User\AppData\Local\Temp\build7724510199007360408.tmp\HumiditySensor.cpp.o 

HumiditySensor.ino:11:5: error: no matching function for call to 'DHT::DHT()'

HumiditySensor.ino:11:5: note: candidates are:

In file included from HumiditySensor.ino:3:0:

C:\Users\User\Documents\Arduino\libraries\DHT/DHT.h:31:3: note: DHT::DHT(uint8_t, uint8_t, uint8_t)

   DHT(uint8_t pin, uint8_t type, uint8_t count=6);

   ^

C:\Users\User\Documents\Arduino\libraries\DHT/DHT.h:31:3: note:   candidate expects 3 arguments, 0 provided

C:\Users\User\Documents\Arduino\libraries\DHT/DHT.h:23:7: note: DHT::DHT(const DHT&)

 class DHT {

       ^

C:\Users\User\Documents\Arduino\libraries\DHT/DHT.h:23:7: note:   candidate expects 1 argument, 0 provided

HumiditySensor.ino: In function 'void setup()':

HumiditySensor.ino:22:7: error: 'class DHT' has no member named 'setup'

HumiditySensor.ino: In function 'void loop()':

HumiditySensor.ino:36:13: error: 'class DHT' has no member named 'getMinimumSamplingPeriod'

HumiditySensor.ino:38:27: error: 'class DHT' has no member named 'getTemperature'

HumiditySensor.ino:44:25: error: 'class DHT' has no member named 'toFahrenheit'

HumiditySensor.ino:51:24: error: 'class DHT' has no member named 'getHumidity'

Error compiling.

Thanks Jamie

Could you have the wrong DHT library? Are you using this one?
https://github.com/mysensors/Arduino/tree/master/libraries/DHT

It is possible that it is the wrong dht library. I am now away fora couple of weeks so will check when i get home & let you know.

Thanks Jamie

Thx, not an answer