Salinity and temperature sensors are implemented in classes.

Dependencies:   mbed

Committer:
mariosimaremare
Date:
Thu Jun 16 11:28:59 2016 +0000
Revision:
3:7c648d1d8802
Parent:
2:ed17e258da0d
Child:
5:4cbe44452889
Spread the code into classes.; Median is implemented.

Who changed what in which revision?

UserRevisionLine numberNew 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 0:ad9362f18797 19 PinName pin,
mariosimaremare 0:ad9362f18797 20 double const_voltage,
mariosimaremare 0:ad9362f18797 21 double const_converter,
mariosimaremare 2:ed17e258da0d 22 double const_lower_boundary,
mariosimaremare 2:ed17e258da0d 23 double const_upper_boundary,
mariosimaremare 0:ad9362f18797 24 double variance,
mariosimaremare 0:ad9362f18797 25 double vin,
mariosimaremare 0:ad9362f18797 26 double resistance
mariosimaremare 0:ad9362f18797 27 );
mariosimaremare 2:ed17e258da0d 28 void reload();
mariosimaremare 2:ed17e258da0d 29 double getReading();
mariosimaremare 0:ad9362f18797 30 double getVoltage();
mariosimaremare 0:ad9362f18797 31 double getTemperature();
mariosimaremare 2:ed17e258da0d 32 double getStatus();
mariosimaremare 3:7c648d1d8802 33 char* getStrStatus();
mariosimaremare 0:ad9362f18797 34
mariosimaremare 0:ad9362f18797 35 private:
mariosimaremare 3:7c648d1d8802 36 Printer &_printer;
mariosimaremare 0:ad9362f18797 37 AnalogIn _analog_in;
mariosimaremare 0:ad9362f18797 38 double _const_voltage;
mariosimaremare 0:ad9362f18797 39 double _const_converter;
mariosimaremare 2:ed17e258da0d 40 double _const_lower_boundary;
mariosimaremare 2:ed17e258da0d 41 double _const_upper_boundary;
mariosimaremare 3:7c648d1d8802 42 int _const_sample_number;
mariosimaremare 0:ad9362f18797 43 double _variance;
mariosimaremare 0:ad9362f18797 44 double _vin;
mariosimaremare 0:ad9362f18797 45 double _resistance;
mariosimaremare 1:f448c12d2c5b 46 double _reading;
mariosimaremare 0:ad9362f18797 47 double _voltage;
mariosimaremare 1:f448c12d2c5b 48 double _temperature;
mariosimaremare 2:ed17e258da0d 49 double _status;
mariosimaremare 3:7c648d1d8802 50 char* _strStatus;
mariosimaremare 0:ad9362f18797 51 double _k0;
mariosimaremare 0:ad9362f18797 52 double _k1;
mariosimaremare 0:ad9362f18797 53 double _k2;
mariosimaremare 0:ad9362f18797 54 double _kelvin_to_celcius;
mariosimaremare 0:ad9362f18797 55 };
mariosimaremare 0:ad9362f18797 56
mariosimaremare 0:ad9362f18797 57 #endif