Grelet Jacques
/
Ni-MH_V3
example code using statis library for temperature measurement with LM35 and LM335
Diff: temperatureSensor.h
- Revision:
- 1:5821fa15d6ca
- Child:
- 2:9517837c642d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/temperatureSensor.h Tue Nov 20 12:10:39 2012 +0000 @@ -0,0 +1,46 @@ +/*-------------------------------------------------------------------------*/ +/* TemperatureSensor header class declaration */ +/*-------------------------------------------------------------------------*/ +/* Ni-MH charger project US191 IRD */ +/*-------------------------------------------------------------------------*/ +/* Nov 2012 | J Grelet */ +/*-------------------------------------------------------------------------*/ + +#ifndef temperatureSensor_H +#define temperatureSensor_H + +#include <iostream> +#include "mbed.h" // include mbed library + +class temperatureSensor { + +private: + Ticker _ticker; + AnalogIn _pin; + float _convertion; + float _scaleFactor; + float _temperature; + +public: + // Constructor + temperatureSensor(PinName pin, float delay, float convertion); + + // Destructor + virtual ~temperatureSensor(); + + // method that give the temperature measure of the sensor + float read(void); + + // A shorthand for read() + operator float() { + return read(); + } + +private: + // method that convert voltage measure in temperature + void toDo(void); + +}; + +#endif // temperatureSensor_H +