Tema SCPI Negru Rares-Razvan

Dependencies:   BLE_API mbed nRF51822

Fork of nRF51822_TemperatureEx by Valentin Tanasa

Revision:
13:bd15c17003e7
Parent:
12:7772974713ac
diff -r 7772974713ac -r bd15c17003e7 main.cpp
--- a/main.cpp	Sat Oct 08 10:30:15 2016 +0000
+++ b/main.cpp	Mon Oct 24 10:09:39 2016 +0000
@@ -288,8 +288,28 @@
 
     // use Vin.read() o read the voltage from the AI5 pin    
     // fell free to the fill code in this function ....
-    // aditionally you can declare globals variables at the begining of the file or in myData.h
-    
+   
+    //Let us consider the input voltage ranges from 0-3.3v.That means that the 0 voltage input from AI5 means the temperature of the resistor
+    //is -55 degrees,and a 3v3 input in AI5 means that the termistor is at 125 degrees.
+    //The number of values that can be inputed from 0 to 3v3 is 180 values.
+    //That means that each 0.018V increase on the input means that the temperature rised with 1 degree,and every decrease 
+    //of 0.018V means that the temperature went down with 1 degree Celsius.
+    //Let us now read the voltage from the AI5 pin
+    resistance=Vin.read();
+    //Based on my calculations,if the voltage is under 1.01V,the temperature is negative.With that in mind
+    //We will separate negative from positive values.
+    if(resistance<=1.01)
+    {
+         if(resistance<0.018)
+         {
+             tempValue=-55;
+         }
+         tempValue=-55+resistance/0.018;
+        
+    }
+    tempValue=0+resistance/0.018;
+        
+