Mario Simaremare / Mbed 2 deprecated g3_waterplay

Dependencies:   mbed

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 = 3.3;
00022     static const double CONVERTER = 1.142;
00023     static const double LOWER_BOUNDARY = 28.0;
00024     static const double UPPER_BOUNDARY = 31.9;
00025     static const double VARIANCE = 0.0;
00026     static const double RESISTANCE = 20000.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     bool inBoundary();
00039     bool inDanger();
00040 
00041 private:
00042     Printer &_printer;
00043     AnalogIn _analog_in;
00044     double _reading;
00045     double _voltage;
00046     double _temperature;
00047     double _status;
00048     char* _strStatus;
00049     double _k0;
00050     double _k1;
00051     double _k2;
00052     double _kelvin_to_celcius;
00053     bool _in_boundary;
00054 };
00055 
00056 #endif