For Hepta-Sat Lite

Files at this revision

API Documentation at this revision

Comitter:
heptasat2021
Date:
Tue Aug 17 10:51:03 2021 +0000
Parent:
7:79fba3155857
Commit message:
For Hepta-Sat Lite

Changed in this revision

HeptaTemp.cpp Show annotated file Show diff for this revision Revisions of this file
HeptaTemp.h Show annotated file Show diff for this revision Revisions of this file
diff -r 79fba3155857 -r 3cb7f1ea12bf HeptaTemp.cpp
--- a/HeptaTemp.cpp	Wed Aug 21 12:20:04 2019 +0000
+++ b/HeptaTemp.cpp	Tue Aug 17 10:51:03 2021 +0000
@@ -8,35 +8,8 @@
 
 void HeptaTemp::temp_sense(float* temp)
 {
-//resistance
-    R1 = 2500;
-    R2 = 2500;
-    R3 = 110;
-    R4 = 1000;
-    R5 = 68000;
-    Pt = 100;
-    R_1 = 3;
-    R_2 = 2;
-
-//current
-    I = 0.001;
-
-//voltage
-    Vref = 2.5;
-
-//Gain&Offset
-    float gain = -R5*I/R4;
-    float off = Vref+I*R3;
-
-//temperature coefficient
-    ce = 0.003851;
-    float volt = (_pin.read())*3.3*(R_1 + R_2)/R_1;
-    float Rth = (volt-off)/gain+R3;
-    *temp = (Rth-Pt)/(ce*Pt);
-    
-// delay some time before reading again
-    //wait(0.5);
-
+    //temperature coefficient
+    *temp = ((_pin.read())*3.3-0.6)*100;
 }
 
 void HeptaTemp::temp_sense_u16(char* temp_u16)
@@ -55,8 +28,5 @@
 
 void HeptaTemp::temp_sensing_vol(float* voltage)
 {
-    R_1 = 3;
-    R_2 = 2;
-    *voltage = (_pin.read())*3.3*(R_1 + R_2)/R_1;
-
+    *voltage = (_pin.read())*3.3;
 }
\ No newline at end of file
diff -r 79fba3155857 -r 3cb7f1ea12bf HeptaTemp.h
--- a/HeptaTemp.h	Wed Aug 21 12:20:04 2019 +0000
+++ b/HeptaTemp.h	Tue Aug 17 10:51:03 2021 +0000
@@ -11,20 +11,7 @@
     void temp_sensing_vol(float* voltage);
 
 private:
-//resistance
-    float R1,R2,R3,R4,R5;
-    float Pt;
-    float R_1,R_2;
-//current
-    float I;
-//voltage
-    float Vref;
-    
-//temperature coefficient
-    float ce;
-    
     AnalogIn _pin;
-
 };
 
 #endif