Drivers for temperature and humidity sensor SHF15. Modified for EDE_PRO2_team1

Dependencies:   SHTx mbed

Fork of PRO2_SHT15_Example by Olga Høyer

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers get_humid.cpp Source File

get_humid.cpp

00001 //Author : Olga Hoeyer
00002 //Date : 18 May 2017
00003 //Version : 2.0
00004 //Changes: Structure changed to modular, to ease future use of the funktion.
00005 //Copyright : Open for everyone
00006 //
00007 // Description : Function will get a humidity value from the SHF-15 sensor
00008 // Output is relative humidity (float).
00009 
00010 
00011 #include "mbed.h"
00012 #include "SHTx/sht15.hpp"
00013 
00014 DigitalOut busy(LED1);
00015 //ports on the Nucleo: PB_8, PB_9
00016 SHTx::SHT15 sensor(PB_8, PB_9);
00017 
00018 float GetHumid()
00019 {
00020 //VARIABLES:
00021     float humidity;          //this will be data read from sensor
00022 
00023 // Speed things up a bit.
00024     sensor.setOTPReload(false);
00025     sensor.setResolution(true);
00026 
00027     busy = true;
00028     sensor.update();
00029     busy = false;
00030 
00031     // Temperature in celcius
00032     sensor.setScale(false);
00033     humidity=sensor.getHumidity();        //don't know if it works
00034 
00035     wait(5);
00036     return (humidity);
00037 
00038 }