Mario Simaremare
/
g3_waterplay
Salinity and temperature sensors are implemented in classes.
TemperatureSensor.h@13:142a142a7ac5, 2016-06-22 (annotated)
- Committer:
- mariosimaremare
- Date:
- Wed Jun 22 22:15:33 2016 +0000
- Revision:
- 13:142a142a7ac5
- Parent:
- 5:4cbe44452889
- Child:
- 15:e112bab9aa2f
Fixing message and buzzers.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mariosimaremare | 0:ad9362f18797 | 1 | /* |
mariosimaremare | 0:ad9362f18797 | 2 | * G3: WATERPLAY |
mariosimaremare | 3:7c648d1d8802 | 3 | |
mariosimaremare | 3:7c648d1d8802 | 4 | |
mariosimaremare | 3:7c648d1d8802 | 5 | |
mariosimaremare | 0:ad9362f18797 | 6 | */ |
mariosimaremare | 0:ad9362f18797 | 7 | |
mariosimaremare | 0:ad9362f18797 | 8 | #ifndef TEMPERATURE_SENSOR_H |
mariosimaremare | 0:ad9362f18797 | 9 | #define TEMPERATURE_SENSOR_H |
mariosimaremare | 0:ad9362f18797 | 10 | |
mariosimaremare | 0:ad9362f18797 | 11 | #include "mbed.h" |
mariosimaremare | 3:7c648d1d8802 | 12 | #include "Printer.h" |
mariosimaremare | 0:ad9362f18797 | 13 | |
mariosimaremare | 0:ad9362f18797 | 14 | class TemperatureSensor |
mariosimaremare | 0:ad9362f18797 | 15 | { |
mariosimaremare | 0:ad9362f18797 | 16 | public: |
mariosimaremare | 0:ad9362f18797 | 17 | TemperatureSensor( |
mariosimaremare | 3:7c648d1d8802 | 18 | Printer &printer, |
mariosimaremare | 5:4cbe44452889 | 19 | PinName pin |
mariosimaremare | 0:ad9362f18797 | 20 | ); |
mariosimaremare | 5:4cbe44452889 | 21 | static const double VIN = 4.85; |
mariosimaremare | 5:4cbe44452889 | 22 | static const double CONVERTER = 1.6667; |
mariosimaremare | 5:4cbe44452889 | 23 | static const double LOWER_BOUNDARY = 28.0; |
mariosimaremare | 5:4cbe44452889 | 24 | static const double UPPER_BOUNDARY = 31.9; |
mariosimaremare | 5:4cbe44452889 | 25 | static const double VARIANCE = 5.0; |
mariosimaremare | 5:4cbe44452889 | 26 | static const double RESISTANCE = 15000.0; |
mariosimaremare | 5:4cbe44452889 | 27 | static const int SAMPLING_NUMBER = 100; |
mariosimaremare | 5:4cbe44452889 | 28 | static const double K0 = 0.00102119; |
mariosimaremare | 5:4cbe44452889 | 29 | static const double K1 = 0.000222468; |
mariosimaremare | 5:4cbe44452889 | 30 | static const double K2 = 0.000000133342; |
mariosimaremare | 5:4cbe44452889 | 31 | static const double KELVIN_TO_CELCIUS = -273.15; |
mariosimaremare | 2:ed17e258da0d | 32 | void reload(); |
mariosimaremare | 2:ed17e258da0d | 33 | double getReading(); |
mariosimaremare | 0:ad9362f18797 | 34 | double getVoltage(); |
mariosimaremare | 0:ad9362f18797 | 35 | double getTemperature(); |
mariosimaremare | 2:ed17e258da0d | 36 | double getStatus(); |
mariosimaremare | 3:7c648d1d8802 | 37 | char* getStrStatus(); |
mariosimaremare | 13:142a142a7ac5 | 38 | bool inBoundary(); |
mariosimaremare | 0:ad9362f18797 | 39 | |
mariosimaremare | 0:ad9362f18797 | 40 | private: |
mariosimaremare | 3:7c648d1d8802 | 41 | Printer &_printer; |
mariosimaremare | 0:ad9362f18797 | 42 | AnalogIn _analog_in; |
mariosimaremare | 1:f448c12d2c5b | 43 | double _reading; |
mariosimaremare | 0:ad9362f18797 | 44 | double _voltage; |
mariosimaremare | 1:f448c12d2c5b | 45 | double _temperature; |
mariosimaremare | 2:ed17e258da0d | 46 | double _status; |
mariosimaremare | 3:7c648d1d8802 | 47 | char* _strStatus; |
mariosimaremare | 0:ad9362f18797 | 48 | double _k0; |
mariosimaremare | 0:ad9362f18797 | 49 | double _k1; |
mariosimaremare | 0:ad9362f18797 | 50 | double _k2; |
mariosimaremare | 0:ad9362f18797 | 51 | double _kelvin_to_celcius; |
mariosimaremare | 13:142a142a7ac5 | 52 | bool _in_boundary; |
mariosimaremare | 0:ad9362f18797 | 53 | }; |
mariosimaremare | 0:ad9362f18797 | 54 | |
mariosimaremare | 0:ad9362f18797 | 55 | #endif |