Adafruit HTU21DF Temp/Humidity Sensor Library Port [SOLVED]

Hello,

I am trying to get readings from the Adafruit HTU21D-F Temp and Humidity sensor, but when verifying via web IDE, I get the error:

In file included from ../inc/spark_wiring.h:29:0,
from ../inc/application.h:29,
from Adafruit_HTU21DF.h:20,
from Adafruit_HTU21DF.cpp:17:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
#warning "Defaulting to Release Build"
^
In file included from Adafruit_HTU21DF.cpp:17:0:
Adafruit_HTU21DF.h:22:18: fatal error: Wire.h: No such file or directory
#include "Wire.h"
^
compilation terminated.
make: *** [Adafruit_HTU21DF.o] Error 1

I’ve replaced the standard #include "WProgram.h" with #include "application.h", but am unsure with what to replace #include "Wire.h".

Thanks for the help!

Following @bko’s advice on this post, I added two 4.7k Ohm pull-up resistors on the clock and data lines and commented out #include "Wire.h" in Adafruit_HTU21DF.h and #include <util/delay.h> in Adafruit_HTU21DF.cpp. I’ll post the library to GitHub and then contribute it to the Spark IDE libraries.

2 Likes