Thanks LG for sharing your code. Now I have to laugh. The one part of your code I am truly interested in is the typedef of your struct is the one thing you didn't share. LOL! But I must say looking your code over has help me immensely. I am still learning Arduino and relearning C. I hadn't written any C for 20 years.
You had me worried there for a bit, I thought I had posted old code.
The typedef is there, its inline in the code, which I didn't think was going to work, and I don't think is the right way to do it, but I could not figure out how to do it in a .h file. (To be fair, I was working on my Mother In Laws kitchen table over Christmas break after everyone else had gone to bed.)
typedef struct { // payload structure for radio packet
int Samples; // Number of samples taken
float CurrTemp1; // Most current Temperature reading on sensor 1
float CurrTemp2; // Most current Temperature reading on sensor 2
float AvgTemp1; // Average temperature over the last numReadings
float AvgTemp2; // Average temperature over the last numReadings
} TEMPS;
TEMPS theData;
I remember running into this problem previously, I just haven't had the time to chase this loose end down. In fact, from an older version of the code I found a line (commented out because it wasn't working)
// #include <TempType.h> // Some web info claims typedefs need to be in their own header files.
Clearly it would be cleaner if the typedef was in it's own file to be #included into each sketch.
For Heavens sake, don't use MY code to learn from! I had to take the one credit C course that was required in college
twice to pass it.
In ~1992. And I have not written anything in C since, save for dabbling in Arduino for the past few years, and even that I have not been doing for a year and a half or so.
LG