Drivers for temperature and humidity sensor SHF15. Modified for EDE_PRO2_team1
Fork of PRO2_SHT15_Example by
Diff: main.cpp
- Revision:
- 6:d17b645ed2a5
- Parent:
- 5:40f3f713bba0
--- a/main.cpp Wed May 10 20:14:37 2017 +0000 +++ b/main.cpp Thu May 18 21:21:13 2017 +0000 @@ -5,46 +5,17 @@ * Original Copyright (c) 2010 Roy van Dam <roy@negative-black.org> **/ -#include "mbed.h" //NOTE. Compiler gives an error: -#include "SHTx/sht15.hpp" //"CMSIS Target not recognised" +#include "mbed.h" +#include <get_temp.h> +#include <get_humid.h> //GLOBAL VARIABLES: -float temperature, humidity; //this will be data read from sensor -void GetTemperatureAndHumidity(); - -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); +float temp, hum; //this will be data read from sensor -int -main() +int main() { - GetTemperatureAndHumidity(); + temp =GetTemperature(); + hum=GetHumid(); } -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 - humidity=sensor.getHumidity(); //don't know if it works - - wait(5); - return; -} -} \ No newline at end of file