Meditech control panel software  1.0beta
application C++ firmware for control panel ChipKit PI board
 All Classes Files Functions Variables Typedefs Macros Pages
Temperature Class Reference

#include "Temperature.h"

Public Member Functions

 Temperature ()
 Temperature class constructor. More...
 
void CalcTemp (float sensor)
 Convert the analog value to the respective value. More...
 
float Celsius () const
 Return the last temperature read in Celsius deg. More...
 
float Fahrenheit () const
 Return the last temperature read in Fahrenheit deg. More...
 
float Kelvin () const
 Return the last temperature read in Kelvin deg. More...
 
float Rankine () const
 Return the last temperature read in Rankine deg. More...
 

Private Attributes

float _Celsius
 
float _Fahrenheit
 
float _Kelvin
 
float _Rankine
 
float _sensorValue
 

Detailed Description

Definition at line 22 of file Temperature.h.

Constructor & Destructor Documentation

Temperature::Temperature ( )

Temperature class constructor.

Set the analog pin for data reading

Definition at line 31 of file Temperature.cpp.

31  {
32  }

Member Function Documentation

void Temperature::CalcTemp ( float  sensor)

Convert the analog value to the respective value.

As the call to the temperature reading is not a high priority task and does not need very high responsivity, when the analog data are read they are immediately converted to the three temperature scales: Celsius, Kelvin and Farehneit.

Definition at line 41 of file Temperature.cpp.

References _Celsius, _Fahrenheit, _Kelvin, _Rankine, _sensorValue, ABSOLUTE_ZERO_CELSIUS, and TEMP_OFFSET.

Referenced by setup(), and tempMonitor().

41  {
42 
43  _sensorValue = sensor;
44  _Celsius = (((_sensorValue / 1024) * 5) * 100) - TEMP_OFFSET; // convert the reading to C
45  _Fahrenheit = _Celsius * 1.8 + 32.0; // convert the reading to F
46  _Kelvin = _Celsius - ABSOLUTE_ZERO_CELSIUS; // convert the reading to K
47  _Rankine = ((_Celsius - ABSOLUTE_ZERO_CELSIUS) * 9) / 5; // convert the reading do R
48 }
float _Rankine
Definition: Temperature.h:35
float _Celsius
Definition: Temperature.h:32
#define TEMP_OFFSET
Celsius temperature offset. Should be calibrated depending on the analog reading from the choosen chi...
Definition: Temperature.h:17
float _Fahrenheit
Definition: Temperature.h:33
float _Kelvin
Definition: Temperature.h:34
float _sensorValue
Definition: Temperature.h:36
#define ABSOLUTE_ZERO_CELSIUS
Absolute zero value for calculation.
Definition: Temperature.h:12
float Temperature::Celsius ( ) const

Return the last temperature read in Celsius deg.

Definition at line 51 of file Temperature.cpp.

References _Celsius.

Referenced by showTemp().

51  {
52  return(_Celsius);
53 }
float _Celsius
Definition: Temperature.h:32
float Temperature::Fahrenheit ( ) const

Return the last temperature read in Fahrenheit deg.

Definition at line 56 of file Temperature.cpp.

References _Fahrenheit.

56  {
57  return(_Fahrenheit);
58 }
float _Fahrenheit
Definition: Temperature.h:33
float Temperature::Kelvin ( ) const

Return the last temperature read in Kelvin deg.

Definition at line 61 of file Temperature.cpp.

References _Kelvin.

61  {
62  return(_Kelvin);
63 }
float _Kelvin
Definition: Temperature.h:34
float Temperature::Rankine ( ) const

Return the last temperature read in Rankine deg.

Definition at line 66 of file Temperature.cpp.

References _Rankine.

66  {
67  return(_Rankine);
68 }
float _Rankine
Definition: Temperature.h:35

Member Data Documentation

float Temperature::_Celsius
private

Definition at line 32 of file Temperature.h.

Referenced by CalcTemp(), and Celsius().

float Temperature::_Fahrenheit
private

Definition at line 33 of file Temperature.h.

Referenced by CalcTemp(), and Fahrenheit().

float Temperature::_Kelvin
private

Definition at line 34 of file Temperature.h.

Referenced by CalcTemp(), and Kelvin().

float Temperature::_Rankine
private

Definition at line 35 of file Temperature.h.

Referenced by CalcTemp(), and Rankine().

float Temperature::_sensorValue
private

Definition at line 36 of file Temperature.h.

Referenced by CalcTemp().


The documentation for this class was generated from the following files: