Changeset 21 for trunk/Arduino/projects/OT_boiler/OT_boiler.ino
- Timestamp:
- Sep 10, 2019, 8:56:08 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/Arduino/projects/OT_boiler/OT_boiler.ino (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Arduino/projects/OT_boiler/OT_boiler.ino
r19 r21 21 21 volatile bool _connected = false; 22 22 23 OT_Slave boiler; 23 class OT_Boiler : public OT_Slave { 24 25 protected: 26 int a2; 27 28 public: 29 virtual float GetBoilerTemperature (); 30 virtual float GetReturnTemperature (); 31 32 friend void loop(); 33 }; 34 35 OT_Boiler boiler; 24 36 25 37 EthernetClient client; … … 83 95 unsigned long periode = msTicks / (boiler.IsActive() ? 500 : 2000); 84 96 static unsigned long prev = 0; 85 86 int a2 = analogRead(A2); // read the input pin87 #ifdef _R9_22K_88 const double m = 0.1309;89 const double b = -9.4535;90 #elif defined(_R9_15K_1_)91 const double m = 0.1746;92 const double b = -13.164;93 #else94 const double m = 0.1848;95 const double b = (-12.936 - 5.5);96 #endif97 double ta2 = m*double(a2)+b;98 99 97 if (prev != periode) { 100 98 prev = periode; 101 99 int led = (periode & 1) ? HIGH : LOW; 102 100 if (Serial) { 101 float tBoiler = boiler.GetBoilerTemperature(); 103 102 Serial.print("Time: "); 104 103 Serial.print(msTicks); … … 107 106 Serial.print("\tLED: "); 108 107 Serial.print(led); 109 Serial.print("\tA2: ");110 Serial.print(a2);111 Serial.print("\tT(A2): ");112 Serial.println(ta2);108 Serial.print("\tA2: "); 109 Serial.print(boiler.a2); 110 Serial.print("\tT(A2): "); 111 Serial.println(tBoiler); 113 112 } 114 113 digitalWrite(ACTIVITY_LED_PIN, led); … … 179 178 } 180 179 } 180 181 float OT_Boiler::GetBoilerTemperature () 182 { 183 a2 = analogRead(A2); // read the input pin 184 const double m = 0.1848; 185 const double b = -17.4056; 186 tBoiler = double(m*double(a2)+b); 187 return tBoiler; 188 } 189 190 float OT_Boiler::GetReturnTemperature () 191 { 192 return OT_Slave::GetReturnTemperature (); 193 }
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/Paradigma/chrome/site/paradigma.png)