Сбор информации о погодных условиях

Dependencies:   RF24 USBDevice mbed

Revision:
6:db4538895ae7
Parent:
4:7cd67d988145
--- a/Sensors/Thermistor.cpp	Wed Oct 28 20:52:12 2015 +0000
+++ b/Sensors/Thermistor.cpp	Sat Dec 05 16:57:30 2015 +0000
@@ -6,12 +6,17 @@
     this->c = c;
 }
 
+
 double Thermistor::getTemperature(){
+    return getTemperatureByAdcValue(input.read(), a, b, c, error);
+}
+
+double Thermistor::getTemperatureByAdcValue(float adcVal, double a, double b, double c, double error){
     double temp;
     double realV;
     double resistance;
         //3.3 - ADC maximum
-    realV = input.read()*3.3;
+    realV = adcVal*3.3;
     resistance = (10000 * 3.3) / realV - 10000;
         //Considering the error
     resistance -= error;
@@ -23,6 +28,7 @@
     return temp;
 }
     
+    
     void Thermistor::setError(double error){
         this->error = error;
     }
@@ -53,4 +59,16 @@
     
     double Thermistor::getCoefficientC(){
         return c;
-    }
\ No newline at end of file
+    }
+    
+    bool ThermistorTest::adcValue_0_049_is_0_degree(){
+        return abs(Thermistor::getTemperatureByAdcValue(0.049, 0.001995, 0.00007997, 0.0000003863)) < 1.0;
+    }
+
+    bool ThermistorTest::adcValue_0_104_is_15_degree(){
+        return abs(Thermistor::getTemperatureByAdcValue(0.104, 0.001995, 0.00007997, 0.0000003863) - 15.0) < 1.0;
+    }    
+    
+    bool ThermistorTest::adcValue_0_202_is_30_degree(){
+        return abs(Thermistor::getTemperatureByAdcValue(0.202, 0.001995, 0.00007997, 0.0000003863) - 30.0) < 1.0;
+    }    
\ No newline at end of file