MEAS HTU21D XPLAINED PRO BOARD
Digital Humidity DCS Development Tools
SENSOR SOLUTIONS /// MEAS HTU21D XPLAINED PRO BOARD 05/2016
return -1;
// Alternate between w and w/o hold temperature read
if( n&1 )
htu21_set_i2c_master_mode(htu21_i2c_no_hold);
else
htu21_set_i2c_master_mode(htu21_i2c_hold);
status = htu21_read_temperature_and_relative_humidity(&temperature, &relative_humidity);
if( status != htu21_status_ok)
return -1;
compensated_humidity = htu21_compute_compensated_humidity(temperature,relative_humidity);
dew_point = htu21_compute_dew_point(temperature,relative_humidity);
variation += temperature - last_temperature;
// Look for significant temperature variation
if ( variation >= 0.5 ) {
// Yes, so turn LED on.
port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE);
variation = 0;
} else if ( variation <= -0.5 ) {
// No, so turn LED off.
port_pin_set_output_level(LED_0_PIN, LED_0_INACTIVE);
variation = 0;
}
delay_ms(500);
last_temperature = temperature;
n++;
if(n==50) n=0;
}
return 0;
}