Changeset 25 for trunk


Ignore:
Timestamp:
Sep 27, 2019, 9:39:31 AM (7 years ago)
Author:
markus
Message:
  • Adjust temerature calculation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Arduino/projects/OT_boiler/OT_boiler.ino

    r21 r25  
    2525protected:
    2626        int             a2;
     27  int   a3;
     28  int   a4;
     29
     30  virtual double AD2Temperature (int);
    2731
    2832public:
    … …  
    99103          int led = (periode & 1) ? HIGH : LOW;
    100104          if (Serial) {
    101                   float tBoiler = boiler.GetBoilerTemperature();
    102105                  Serial.print("Time: ");
    103106                  Serial.print(msTicks);
    … …  
    106109                  Serial.print("\tLED: ");
    107110                  Serial.print(led);
     111      float tBoiler = boiler.GetBoilerTemperature();
    108112                  Serial.print("\tA2: ");
    109113                  Serial.print(boiler.a2);
    110114                  Serial.print("\tT(A2): ");
    111                   Serial.println(tBoiler);
     115                  Serial.print(tBoiler);
     116      float tReturn = boiler.GetReturnTemperature();
     117      Serial.print("\tA3: ");
     118      Serial.print(boiler.a3);
     119      Serial.print("\tT(A3): ");
     120      Serial.println(tReturn);
    112121          }
    113122          digitalWrite(ACTIVITY_LED_PIN, led);
    … …  
    179188}
    180189
     190double OT_Boiler::AD2Temperature (int x)
     191{
     192  const double m = 0.2059;
     193  const double b = -27.951;
     194  return m*double(x)+b;
     195}
     196
    181197float OT_Boiler::GetBoilerTemperature ()
    182198{
    183199        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);
     200        tBoiler = AD2Temperature(a2);
    187201        return tBoiler;
    188202}
    … …  
    190204float OT_Boiler::GetReturnTemperature ()
    191205{
    192         return OT_Slave::GetReturnTemperature ();
    193 }
     206  a3 = analogRead(A3);   // read the input pin
     207  tReturn = AD2Temperature(a3);
     208  return tReturn;
     209}
Note: See TracChangeset for help on using the changeset viewer.