example code using statis library for temperature measurement with LM35 and LM335

Dependencies:   mbed statis

Committer:
greletj
Date:
Tue Nov 20 15:13:50 2012 +0000
Revision:
2:9517837c642d
Parent:
1:5821fa15d6ca
with  first filter version of C Richard

Who changed what in which revision?

UserRevisionLine numberNew contents of line
greletj 1:5821fa15d6ca 1 /*-------------------------------------------------------------------------*/
greletj 1:5821fa15d6ca 2 /* TemperatureSensor header class declaration */
greletj 1:5821fa15d6ca 3 /*-------------------------------------------------------------------------*/
greletj 1:5821fa15d6ca 4 /* Ni-MH charger project US191 IRD */
greletj 1:5821fa15d6ca 5 /*-------------------------------------------------------------------------*/
greletj 1:5821fa15d6ca 6 /* Nov 2012 | J Grelet */
greletj 1:5821fa15d6ca 7 /*-------------------------------------------------------------------------*/
greletj 1:5821fa15d6ca 8
greletj 1:5821fa15d6ca 9 #ifndef temperatureSensor_H
greletj 1:5821fa15d6ca 10 #define temperatureSensor_H
greletj 1:5821fa15d6ca 11
greletj 1:5821fa15d6ca 12 #include <iostream>
greletj 1:5821fa15d6ca 13 #include "mbed.h" // include mbed library
greletj 2:9517837c642d 14 #include "filter.h"
greletj 2:9517837c642d 15 #include "nimh.h"
greletj 1:5821fa15d6ca 16
greletj 1:5821fa15d6ca 17 class temperatureSensor {
greletj 1:5821fa15d6ca 18
greletj 1:5821fa15d6ca 19 private:
greletj 1:5821fa15d6ca 20 Ticker _ticker;
greletj 1:5821fa15d6ca 21 AnalogIn _pin;
greletj 1:5821fa15d6ca 22 float _convertion;
greletj 1:5821fa15d6ca 23 float _scaleFactor;
greletj 1:5821fa15d6ca 24 float _temperature;
greletj 2:9517837c642d 25 filter _filter;
greletj 1:5821fa15d6ca 26
greletj 1:5821fa15d6ca 27 public:
greletj 1:5821fa15d6ca 28 // Constructor
greletj 2:9517837c642d 29 temperatureSensor(PinName pin, float delay, float convertion, MODE mode, size_t size);
greletj 1:5821fa15d6ca 30
greletj 1:5821fa15d6ca 31 // Destructor
greletj 1:5821fa15d6ca 32 virtual ~temperatureSensor();
greletj 1:5821fa15d6ca 33
greletj 1:5821fa15d6ca 34 // method that give the temperature measure of the sensor
greletj 1:5821fa15d6ca 35 float read(void);
greletj 1:5821fa15d6ca 36
greletj 1:5821fa15d6ca 37 // A shorthand for read()
greletj 1:5821fa15d6ca 38 operator float() {
greletj 1:5821fa15d6ca 39 return read();
greletj 1:5821fa15d6ca 40 }
greletj 1:5821fa15d6ca 41
greletj 1:5821fa15d6ca 42 private:
greletj 1:5821fa15d6ca 43 // method that convert voltage measure in temperature
greletj 1:5821fa15d6ca 44 void toDo(void);
greletj 1:5821fa15d6ca 45
greletj 1:5821fa15d6ca 46 };
greletj 1:5821fa15d6ca 47
greletj 1:5821fa15d6ca 48 #endif // temperatureSensor_H
greletj 1:5821fa15d6ca 49