Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
TemperatureController.h
00001 #ifndef __TEMPERATURECONTROLLER_H__ 00002 #define __TEMPERATURECONTROLLER_H__ 00003 00004 #include "mbed.h" 00005 #include "settings.h" 00006 #include "SensorController.h" 00007 00008 00009 /** The TemperatureController measures the Vernier temperature probe. 00010 */ 00011 class TemperatureController : public SensorController { 00012 public: 00013 /** 00014 * Constructs a new TemperatureController that measures and averages the value from the temperature probe. 00015 * @param threaded whether or not the controller should be threaded. 00016 * @param interval_ms delay between each iteration, only if threaded is set to \a true. 00017 */ 00018 TemperatureController(bool threaded, int interval_ms) : SensorController(threaded, interval_ms) {printf("Initiate Temperature Controller\r\n");} 00019 00020 /** Returns the Temperature measured (in Celsius) during the last update() */ 00021 virtual float getValue(); 00022 00023 /** Measures the Temperature N times and stores the average value of these measurements. */ 00024 virtual void update(); 00025 00026 /** Returns "TemperatureController" */ 00027 virtual std::string getName(); 00028 00029 virtual void setLed(bool); 00030 00031 private: 00032 /** 00033 * The latest temperature measurement, average of N measurements. 00034 */ 00035 float temperature; 00036 00037 /** 00038 * This reads the temperature. 00039 * @return Return the average temperature over N reads in Celsius. 00040 */ 00041 static float readSensor(); 00042 00043 /** 00044 * Returns value read from mbed to Celsius. 00045 * @return temperature in Celsius. 00046 */ 00047 static float analoginToCelsius(float); 00048 00049 /** 00050 * Adjusts value for measurement mistakes. 00051 * @return adjusted value in volt. 00052 */ 00053 static float getOffset(float); 00054 00055 }; 00056 00057 #endif
Generated on Tue Jul 12 2022 18:59:29 by
1.7.2