-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoolATP.h
185 lines (152 loc) · 4.98 KB
/
coolATP.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/**
* coolATP - cool arduino temperature probes (coolATP)
*
* Christian
* graetz23@gmail.com
* created 20191222
* version 20200405
*
* MIT License
*
* Copyright (c) 2019-2020 coolATP Christian (graetz23@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __ARDUINO_coolATP_H__
#define __ARDUINO_coolATP_H__
#include <Arduino.h>
#define ATP_DEBUG true;
#define ATP_PIN_PROBE_0 A0 // TODO let this be an array
#define ATP_PIN_PROBE_0_ID 0 // TODO let this be an array
#define ATP_PIN_PROBE_1 A1 // TODO let this be an array
#define ATP_PIN_PROBE_1_ID 1 // TODO let this be an array
#define ATP_PIN_PROBE_2 A2 // TODO let this be an array
#define ATP_PIN_PROBE_2_ID 2 // TODO let this be an array
#define ATP_PIN_PROBE_3 A3 // TODO let this be an array
#define ATP_PIN_PROBE_3_ID 3 // TODO let this be an array
#define ATP_PIN_PROBE_4 A4 // TODO let this be an array
#define ATP_PIN_PROBE_4_ID 4 // TODO let this be an array
#define ATP_PIN_PROBE_5 A0 // TODO let this be an array
#define ATP_PIN_PROBE_5_ID 5 // TODO let this be an array
/**
* The cool ATP - cool arduino temperature probes
*/
class ATP {
private:
double _cnst_resistance_probe; // the increments of the analog input
double _cnst_resolution; // the increments of the analog input
double _val_analog; // the analog value
double _val_resistor; // the resistor value
double _val_celsius; // the calculated degree celsius
double _val_kelvin; // the calculated kelvin
public:
/*!
* \brief Constructor used for 10 k Ohm and an analog resolution of 1024.
*/
ATP( void );
/*!
* \brief Destructor
*/
virtual ~ATP( void );
/*!
* \brief Call this to set your base conditions
*/
virtual void setup( void );
/*!
* \brief call this to update the measurement and internal calculations
*/
virtual void loop( void );
/*!
* \brief call this to read the analog value of a NTC probes of certain ID;
* e.g. id = 0 => input A0 on arduino.
*/
double readNTCProbe( int id );
/*!
* \brief call this to read the resistor value of a NTC probes of certain ID.
*/
double readNTCProbe_resistor( int id );
/*!
* \brief call this to read the kelvin value of a NTC probes of certain ID.
*/
double readNTCProbe_kelvin( int id );
/*!
* \brief call this to read the temperature value in degree celsius of a
* NTC probes of certain ID.
*/
double readNTCProbe_Celsius( int id );
/*!
* \brief calculates the resistor value in Ohm from the analog value
* \param needs the analog value
* \return the resistor value
*/
double analog_to_Resistor( double val_analog );
/*!
* \brief calculates the kelvin from the analog value
* \param needs the analog value
* \return the kelvin
*/
double analog_to_Kelvin( double val_analog );
/*!
* \brief calculates the degree celsius from the kelvin
* \param needs the kelvin
* \return the degree celsius
*/
double kelvin_to_Celsius( double val_kelvin );
/*!
* \brief Getter for the analog value
* \return analog value
*/
double get_Analog( void );
/*!
* \brief Getter for the resistor
* \return resistor
*/
double get_Resistor( void );
/*!
* \brief Getter for the kelvin
* \return kelvin
*/
double get_Kelvin( void );
/*!
* \brief Getter for the degree celsius
* \return degree celsius
*/
double get_Celsius( void );
/*!
* \brief Getter for the analog value as string
* \return analog value as char string
*/
char* get_Analog_as_cString( void );
/*!
* \brief Getter for the resistor value in Ohm as string
* \return the resistor value in Ohm as char string
*/
char* get_Resistor_as_cString( void );
/*!
* \brief Getter for the kelvin as string
* \return kelvin as char string
*/
char* get_Kelvin_as_cString( void );
/*!
* \brief Getter for the degree celsius as string
* \return degree celsius as char string
*/
char* get_Celsius_as_cString( void );
}; // class
#endif