Drivers for temperature and humidity sensor SHF15. Modified for EDE_PRO2_team1
Fork of PRO2_SHT15_Example by
Revision 2:4fba73b78e1c, committed 2017-05-09
- Comitter:
- OlgaHoeyer
- Date:
- Tue May 09 20:55:08 2017 +0000
- Parent:
- 1:4c7450d9de9d
- Child:
- 3:0759c60f116b
- Commit message:
- added global variables: Temp and Hum, ; Structure changed to the used defined function.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon May 08 12:13:13 2017 +0000 +++ b/main.cpp Tue May 09 20:55:08 2017 +0000 @@ -5,31 +5,41 @@ #include "mbed.h" #include "SHTx/sht15.hpp" -Serial pc(USBTX, USBRX); -DigitalOut busy(LED1); +//GLOBAL VARIABLES: +float temperature, humidity; +void GetTemperatureAndHumidity(); -//ports on the Nucleo: -SHTx::SHT15 sensor(PB_8, PB_9); +Serial pc(USBTX, USBRX); +DigitalOut busy(LED1); //Don't think we need it. + +//ports on the Nucleo: PB_8, PB_9 +SHTx::SHT15 sensor(PB_8, PB_9); int -main() { - // Speed things up a bit. - sensor.setOTPReload(false); - sensor.setResolution(true); - - while(1) { - busy = true; - sensor.update(); - busy = false; - - // Temperature in celcius - sensor.setScale(false); - pc.printf("Temperature [ %3.2f C ]\r\n", sensor.getTemperature()); //SKAL RETTES - - // Relative Humidity - pc.printf("Humdity [ %3.2f %% ]\r\n\n", sensor.getHumidity()); //SKAL RETTES - - wait(5); - } +main() +{ + GetTemperatureAndHumidity(); } + +void GetTemperatureAndHumidity() +// Speed things up a bit. +sensor.setOTPReload(false); +sensor.setResolution(true); + +while(1) +{ + busy = true; + sensor.update(); + busy = false; + + // Temperature in celcius + sensor.setScale(false); + Temperature=sensor.getTemperature(); //don't know if it works + + // Relative Humidity + Humdity=sensor.getHumidity(); //don't know if it works + + wait(5); + return (); +} \ No newline at end of file