ok

Dependencies:   mbed

Fork of g3_waterplay by Mario Simaremare

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TemperatureSensor.h Source File

TemperatureSensor.h

00001 /*
00002 * G3: WATERPLAY
00003 
00004 
00005 
00006 */
00007 
00008 #ifndef TEMPERATURE_SENSOR_H
00009 #define TEMPERATURE_SENSOR_H
00010 
00011 #include "mbed.h"
00012 #include "Printer.h"
00013 
00014 class TemperatureSensor
00015 {
00016 public:
00017     TemperatureSensor(
00018         Printer &printer,
00019         PinName pin
00020     );
00021     static const double VIN = 4.85;
00022     static const double CONVERTER = 1.6667;
00023     static const double LOWER_BOUNDARY = 28.0;
00024     static const double UPPER_BOUNDARY = 31.9;
00025     static const double VARIANCE = 5.0;
00026     static const double RESISTANCE = 15000.0;
00027     static const int SAMPLING_NUMBER = 100;
00028     static const double K0 = 0.00102119;
00029     static const double K1 = 0.000222468;
00030     static const double K2 = 0.000000133342;
00031     static const double KELVIN_TO_CELCIUS = -273.15;
00032     void reload();
00033     double getReading();
00034     double getVoltage();
00035     double getTemperature();
00036     double getStatus();
00037     char* getStrStatus();
00038 
00039 private:
00040     Printer &_printer;
00041     AnalogIn _analog_in;
00042     double _reading;
00043     double _voltage;
00044     double _temperature;
00045     double _status;
00046     char* _strStatus;
00047     double _k0;
00048     double _k1;
00049     double _k2;
00050     double _kelvin_to_celcius;
00051 };
00052 
00053 #endif