updated
Dependencies: mbed Nucleo_Sensor_Shield
Diff: main.cpp
- Revision:
- 4:0c2adcf321c4
- Parent:
- 3:53d2d440a695
--- a/main.cpp Wed Jan 30 03:03:58 2019 +0000 +++ b/main.cpp Fri Feb 15 06:22:22 2019 +0000 @@ -11,8 +11,10 @@ Ticker update; volatile float TEMPERATURE_C; - -<<<<<<<<Declarations should be here >>>>>>>>>> +volatile float TEMPERATURE_F; +volatile float TEMPERATURE_K; +volatile float HUMIDITY; +volatile float PRESSURE; bool measurements_update = false; @@ -39,12 +41,16 @@ if(measurements_update == true){ /* Read the environmental sensors */ - <<<<<<<< your code should be here >>>>>>>>>> + Sensors->hts221.GetTemperature((float*)&TEMPERATURE_C); + Sensors->hts221.GetHumidity((float*)&HUMIDITY); + Sensors->lps25h.GetPressure((float*)&PRESSURE); + TEMPERATURE_F = (TEMPERATURE_C * 1.8f) + 32.0f; + TEMPERATURE_K = (TEMPERATURE_C + 273.15f); pc.printf("Temperature:\t %.2f C / %.2f F / %.2f K\r\n", TEMPERATURE_C, TEMPERATURE_F, TEMPERATURE_K); - - + pc.printf("Humidity:\t %.2f%%\r\n", HUMIDITY); + pc.printf("Pressure:\t %.2fhPa\r\n", PRESSURE); pc.printf("\r\n");