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

Dependencies:   mbed statis

temperatureSensor.h

Committer:
greletj
Date:
2012-11-20
Revision:
1:5821fa15d6ca
Child:
2:9517837c642d

File content as of revision 1:5821fa15d6ca:

/*-------------------------------------------------------------------------*/
/*                 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