COMPILING THE SOIL_SENSOR_TEST SKETCH FROM SENSIRION

Hi,

I am working on a Wireless Gardening project (Arduino sketch | Wireless Gardening with Arduino + CC3000 WiFi Modules | Adafruit Learning System) and having trouble compiling the the soil_sensor_test sketch which I downloaded from GitHub (https://github.com/openhomeautomation/wireless-gardening-arduino) for the SHT10 sensor. I am using the following code:

/*************************************************** 
  This is a sketch to test the soil sensor based
  on the SHT10 temperature & humidity sensor 
  
  Written by Marco Schwartz for Open Home Automation
 ****************************************************/

// Include Sensirion library
#include <Sensirion.h>

// Sensor pins
const uint8_t dataPin  =  6;
const uint8_t clockPin =  7;

// Variables for the temperature & humidity sensor
float temperature;
float humidity;
float dewpoint;

// Create sensor instance
Sensirion soilSensor = Sensirion(dataPin, clockPin);

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  // Make a measurement
  soilSensor.measure(&temperature, &humidity, &dewpoint);

  // Print results
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" C, Humidity: ");
  Serial.print(humidity);
  Serial.print(" %");
  Serial.println("");
  
  // Wait 100 ms before next measurement
  delay(100);  
}

I am using an Arduino Uno and IDE version 1.0.6. (as suggested to use for the CC3000 which is part of this module). When I try to verify the code, I get multiple error messages:

/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:24:26: error: WConstants.h: No such file or directory
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In constructor 'Sensirion::Sensirion(uint8_t, uint8_t)':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:82: error: 'OUTPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:82: error: 'pinMode' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In member function 'uint8_t Sensirion::meas(uint8_t, uint16_t*, bool)':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:131: error: 'digitalRead' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:135: error: 'delay' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In member function 'uint8_t Sensirion::measRdy()':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:147: error: 'digitalRead' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In member function 'uint8_t Sensirion::putByte(uint8_t)':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:235: error: 'OUTPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:235: error: 'pinMode' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:238: error: 'digitalWrite' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:239: error: 'delayMicroseconds' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:240: error: 'HIGH' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:242: error: 'LOW' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:246: error: 'INPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:248: error: 'digitalWrite' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:250: error: 'HIGH' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:251: error: 'delayMicroseconds' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:252: error: 'digitalRead' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:255: error: 'LOW' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In member function 'uint8_t Sensirion::getByte(bool)':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:265: error: 'HIGH' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:265: error: 'digitalWrite' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:266: error: 'delayMicroseconds' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:267: error: 'digitalRead' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:268: error: 'LOW' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:271: error: 'OUTPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:271: error: 'pinMode' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:272: error: 'digitalWrite' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:273: error: 'delayMicroseconds' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:274: error: 'HIGH' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:276: error: 'LOW' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:278: error: 'INPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In member function 'void Sensirion::startTransmission()':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:298: error: 'HIGH' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:298: error: 'digitalWrite' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:299: error: 'OUTPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:299: error: 'pinMode' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:300: error: 'delayMicroseconds' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:303: error: 'LOW' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp: In member function 'void Sensirion::resetConnection()':
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:325: error: 'HIGH' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:325: error: 'digitalWrite' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:326: error: 'OUTPUT' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:326: error: 'pinMode' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:327: error: 'delayMicroseconds' was not declared in this scope
/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:331: error: 'LOW' was not declared in this scope

I did some digging and found this thread with similar issues: http://forum.arduino.cc/index.php?topic=257961.0

It seems that there may be some compatibility issues with the IDE version, but don’t really understand why. I am still quite new and have trouble debugging this. Any ideas what the issue could be?

Thanks so much for your help!

Looks like the library has not been updated for Arduino 1.0.x. Try replacing "WConstatns.h" with "Arduino.h".

Thanks for the quick response. I cannot see #include "WConstants.h" in the code. Where should I replace this?

Where should I replace this?

In the file that includes it. The one that won't compile.

Things don't get much clearer than what the error message tells you:

/Users/Depose/Documents/Arduino/libraries/Sensirion/Sensirion.cpp:24:26: error: WConstants.h: No such file or directory