Drivers for temperature and humidity sensor SHF15. Modified for EDE_PRO2_team1
Fork of PRO2_SHT15_Example by
main.cpp
00001 /** 00002 * Program for reading temperature and humidity from SHT15 00003 * Modified to fit to EDE Pro2 Team 1 project. 00004 * Author Olga Høyer 00005 * Original Copyright (c) 2010 Roy van Dam <roy@negative-black.org> 00006 **/ 00007 00008 #include "mbed.h" //NOTE. Compiler gives an error: 00009 #include "SHTx/sht15.hpp" //"CMSIS Target not recognised" 00010 00011 //GLOBAL VARIABLES: 00012 float temperature, humidity; //this will be data read from sensor 00013 void GetTemperatureAndHumidity(); 00014 00015 Serial pc(USBTX, USBRX); 00016 DigitalOut busy(LED1); //Don't think we need it. 00017 00018 //ports on the Nucleo: PB_8, PB_9 00019 SHTx::SHT15 sensor(PB_8, PB_9); 00020 00021 00022 int 00023 main() 00024 { 00025 GetTemperatureAndHumidity(); 00026 } 00027 00028 void GetTemperatureAndHumidity() 00029 { 00030 // Speed things up a bit. 00031 sensor.setOTPReload(false); 00032 sensor.setResolution(true); 00033 00034 while(1) 00035 { 00036 busy = true; 00037 sensor.update(); 00038 busy = false; 00039 00040 // Temperature in celcius 00041 sensor.setScale(false); 00042 temperature=sensor.getTemperature(); //don't know if it works 00043 00044 // Relative Humidity 00045 humidity=sensor.getHumidity(); //don't know if it works 00046 00047 wait(5); 00048 return; 00049 } 00050 }
Generated on Mon Jul 25 2022 00:42:53 by 1.7.2