This seems like a truly bizarre problem. In trying to help with the question here, I made this little test app which works well to get temperatures from 3 DS18B20’s, except for the variable named T9. I have no idea how this could happen; The value of T9 always comes up as 0, but if I change it to B9 or S9 it works fine. I’ve changed it back and forth several times, retyped everything just to make sure, but I always get the same results. This is the code in the .ino (the full code is in my last post to the question I referenced above).
#include "Dallas.h"
float T1, T2, T3, T4, T5, T6, T7, T8, T9;
float* temps1[] = {&T1, &T2, &T3}; // group sensors by which pin they're connected to
float* temps2[] = {&T4, &T5, &T6};
float* temps3[] = {&T7, &T8, &T9};
void setup() {
Serial.begin(9600);
delay(3000);
}
void loop() {
getTemperatures(*temps1, 3, D4, 0); // the last argument is used to select which array of addresses is used in the Dallas.cpp file
getTemperatures(*temps2, 3, D4, 1);
getTemperatures(*temps3, 3, D4, 2);
if (T7>50) {
Serial.printf(" T1 = %.1f T2 = %.1f T3 = %.1f", T1, T2, T3);
Serial.println();
Serial.printf(" T4 = %.1f T5 = %.1f T6 = %.1f", T4, T5, T6);
Serial.println();
Serial.printf(" T7 = %.1f T8 = %.1f T9 = %.1f", T7, T8, T9); // T9 always prints 0
Serial.println();
Serial.println();
}
delay(10000);
}
There’s nothing apparently unique about T9. I can move it in the array so it’s not last, and I still get 0. If I print out the value of temps3[2], which should be T9, I do get the correct temperature.