unsigned char buffer[100] = { 0 };
/* Gets current temperature & relative humidity. */
float cel = SHT2x_GetTemperature(1);
/* Converts temperature to degrees Fahrenheit and Kelvin */
float fah = SHT2x_CelsiusToFahrenheit(cel);
float kel = SHT2x_CelsiusToKelvin(cel);
float rh = SHT2x_GetRelativeHumidity(1);
/* May show warning below. Ignore and proceed. */
printf("%d.%d, %d.%d , %d.%d K, %d.%d%% RH\r\n",
SHT2x_GetInteger(cel), SHT2x_GetDecimal(cel, 1),
SHT2x_GetInteger(fah), SHT2x_GetDecimal(fah, 1),
SHT2x_GetInteger(kel), SHT2x_GetDecimal(kel, 1),
SHT2x_GetInteger(rh), SHT2x_GetDecimal(rh, 1));
|