Calculate temperature based on resistance from thermistor with lookup chart
Diff: thermister_ert-j0eg1.cpp
- Revision:
- 4:25c01de9fb3f
- Parent:
- 1:cc492e6ba333
diff -r 4141caf9f697 -r 25c01de9fb3f thermister_ert-j0eg1.cpp --- a/thermister_ert-j0eg1.cpp Thu Mar 10 22:15:04 2016 +0000 +++ b/thermister_ert-j0eg1.cpp Fri Jul 15 13:46:23 2016 +0000 @@ -13,7 +13,7 @@ float conv_c_to_f(float tempC) { - return (tempC * 1.8) + 32.0; + return (tempC * 1.8f) + 32.0f; } @@ -25,7 +25,7 @@ float readTemp(AnalogIn adcpin) { //sensorValue = avgRead(adcpin,3,2); float sensorValue = adcpin.read() * adc_ref; - long sensorResist = calcResistV(22000, adc_ref, sensorValue); + long sensorResist = calcResistV(22100, adc_ref, sensorValue); int tempCnt = thermisterBase; int tempndx = 0;