Hepta温度センサー
Dependents: HEPTA_Temp HEPTA2_assembly_0720 HEPTA2_ALL HEPTA2_ALL_ver0803_02 ... more
Diff: HeptaTemp.cpp
- Revision:
- 1:a23c2cd65379
- Parent:
- 0:f74735cb01bc
--- 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