Nathan Hopkins
/
Thermistor
Interfaced 9 MF51E103F3950 NTC 10k Thermistors to a Nucleo board for a science project.
Diff: main.cpp
- Revision:
- 2:cda957297041
- Parent:
- 1:010d1ef2f3ab
- Child:
- 3:cea064439566
--- a/main.cpp Tue Jan 31 16:50:43 2017 +0000 +++ b/main.cpp Tue Jan 31 17:51:43 2017 +0000 @@ -24,12 +24,12 @@ AnalogIn ain3(A3); AnalogIn ain4(A4); AnalogIn ain5(A5); -AnalogIn ain6(PA_5); -AnalogIn ain7(PA_6); // Note: on the Nucleo F401, this is connected to the LED. +AnalogIn ain6(PA_5); // Note: on the Nucleo F401, this is connected to the LED. +AnalogIn ain7(PA_6); AnalogIn ain8(PA_7); float offsets[9] = {0}; -float resistors[9] = {10000.0f, 10000.0f, 10000.0f, 10000.0f, 10000.0f, 10000.0f, 10000.0f, 10000.0f, 10000.0f}; +float resistors[9] = {9984.270169f, 9999.947582f, 9999.962164f, 9999.960999f, 9999.958757f, 9999.918074f, 9999.969933f, 9999.966487f, 9999.977766f}; int main() { @@ -163,13 +163,14 @@ steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To) steinhart = 1.0f / steinhart; // Invert steinhart -= 273.15f; // convert to C - // pc.printf("Temperature %d: %f *C\t", i, steinhart); // Print commas for plotting (except at end): if(i == 8) { pc.printf("%.4f", steinhart); } + else if(i == 6) + continue; // bad analog input (on LED) else { pc.printf("%.4f,", steinhart); }