Hepta温度センサー

Dependents:   HEPTA_Temp HEPTA2_assembly_0720 HEPTA2_ALL HEPTA2_ALL_ver0803_02 ... more

Files at this revision

API Documentation at this revision

Comitter:
hepta2ume
Date:
Fri Jul 21 10:36:09 2017 +0000
Parent:
0:f74735cb01bc
Commit message:
HeptaTemp

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 f74735cb01bc -r a23c2cd65379 HeptaTemp.cpp
--- a/HeptaTemp.cpp	Thu Jul 20 02:15:14 2017 +0000
+++ b/HeptaTemp.cpp	Fri Jul 21 10:36:09 2017 +0000
@@ -8,7 +8,7 @@
 
 void HeptaTemp::temp_sense(float* temp)
 {
-    //resistance
+//resistance
     R1 = 2500;
     R2 = 2500;
     R3 = 110;
@@ -31,13 +31,12 @@
     //printf("%f\r\n",off);
 //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);
-   /* printf("%f\r\n",volt);
-    printf("%f\r\n",Rth);
-    printf("%f\r\n",*temp);*/
+    /* printf("%f\r\n",volt);
+     printf("%f\r\n",Rth);
+     printf("%f\r\n",*temp);*/
     // delay some time before reading again
     wait(0.5);
 
@@ -55,4 +54,12 @@
     temp_u16[2]=temp2[0];
     temp_u16[3]=temp2[1];
     *dsize = 4;
+}
+
+void HeptaTemp::temp_sensing_vol(float* voltage)
+{
+    R_1 = 3;
+    R_2 = 2;
+    *voltage = (_pin.read())*3.3*(R_1 + R_2)/R_1;
+
 }
\ No newline at end of file
diff -r f74735cb01bc -r a23c2cd65379 HeptaTemp.h
--- a/HeptaTemp.h	Thu Jul 20 02:15:14 2017 +0000
+++ b/HeptaTemp.h	Fri Jul 21 10:36:09 2017 +0000
@@ -8,6 +8,7 @@
     HeptaTemp(PinName pin);
     void temp_sense(float* temp);
     void temp_sense_u16(char* temp_u16, int *dsize);
+    void temp_sensing_vol(float* voltage);
 
 private:
 //resistance