A quick look at the lib dc42 pointed to.
there is a line that states : waitForResultSHT(_dataPin);
That is just a blocking wait call, you need to get rid off, so lets hack a bit
add these commands to the library: cannot test as I have no such sensor
You might do the same trick for humidity.
do not forget to add the protos in the .h file too
void SHT1x::requestTemp()
{
// Command to send to the SHT1x to request Temperature
int _gTempCmd = 0b00000011;
sendCommandSHT(_gTempCmd, _dataPin, _clockPin);
}
bool SHT1x::dataReady()
{
pinMode(_dataPin, INPUT);
return digitalRead(_dataPin) == LOW;
}
float SHT1x::asyncReadTempC()
{
const float D1 = -40.0; // for 14 Bit @ 5V
const float D2 = 0.01; // for 14 Bit DEGC
int _val = getData16SHT(_dataPin, _clockPin);
skipCrcSHT(_dataPin, _clockPin);
return (_val * D2) + D1;
}
void setup()
{
...
SHT.requestTemp();
}
void loop()
{
do some here
if (SHT.dataReady())
{
temp = SHT.asyncReadTempC();
SHT.requestTemp();
}
do the rest here
}
as said not tested, so please post the lib if you got it working.
and please change this in the lib, makes it more maintainable...
float SHT1x::readTemperatureF()
{
return readTemperatureC() * 1.8 + 32;
}
Lets post a mail to jon.oxer (maintainer of the lib)
update - mailed jon - time for a cold beer