I recently purchased the Lynx Green kit and I’m having problems with the temperature/humidity sensor. sometimes it works and sometimes it does not. It seems at times it goes into a loop while reading data and never exits. The light and moisture sensors work properly.
Is this a bad sensor or am I doing something wrong?
this is my main.cpp:
#include <Modules/TempHumidity.h>
#include <Modules/LightSense.h>
using namespace gadgeteering;
using namespace gadgeteering::mainboards;
using namespace gadgeteering::modules;
using namespace gadgeteering::system;
int main(int argc, char** argv)
{
fez_lynx_s4 board;
double temp;
double humidity;
temp_humidity tempHumidity(4);
light_sense light(1);
for(int x=0; x<10; x++)
{
unsigned int l = light.get_illuminance();
print((int)l);
tempHumidity.take_measurements(temp, humidity);
print(temp);
}
return 0;
}
this is the code in TempHumidity.cpp which never exits:
//It will take up to 80ms to read. Sensor will
// pull DATA line low when ready
// TODO make this blocking (interrupt?)
while (this->data.read())
{
system::sleep(10);
}
Thanks,
David