Mario Simaremare
/
g3_waterplay
Salinity and temperature sensors are implemented in classes.
Diff: TemperatureSensor.h
- Revision:
- 5:4cbe44452889
- Parent:
- 3:7c648d1d8802
- Child:
- 13:142a142a7ac5
--- a/TemperatureSensor.h Fri Jun 17 09:24:01 2016 +0000 +++ b/TemperatureSensor.h Fri Jun 17 11:03:37 2016 +0000 @@ -16,15 +16,19 @@ public: TemperatureSensor( Printer &printer, - PinName pin, - double const_voltage, - double const_converter, - double const_lower_boundary, - double const_upper_boundary, - double variance, - double vin, - double resistance + PinName pin ); + static const double VIN = 4.85; + static const double CONVERTER = 1.6667; + static const double LOWER_BOUNDARY = 28.0; + static const double UPPER_BOUNDARY = 31.9; + static const double VARIANCE = 5.0; + static const double RESISTANCE = 15000.0; + static const int SAMPLING_NUMBER = 100; + static const double K0 = 0.00102119; + static const double K1 = 0.000222468; + static const double K2 = 0.000000133342; + static const double KELVIN_TO_CELCIUS = -273.15; void reload(); double getReading(); double getVoltage(); @@ -35,14 +39,6 @@ private: Printer &_printer; AnalogIn _analog_in; - double _const_voltage; - double _const_converter; - double _const_lower_boundary; - double _const_upper_boundary; - int _const_sample_number; - double _variance; - double _vin; - double _resistance; double _reading; double _voltage; double _temperature;