I have a bunch of one wire DS18 temperature sensors that are read every few minutes. I want to calculate some statistics for each sensor using the Statistic library. I am using a struct as follow;
struct sensor {
byte address[8];
String label;
String application;
String status;
String found;
String currtemp;
Statistic myStats;
} DS18B20sensors[] = {
{ { 0x28, 0xff, 0x07, 0x85, 0x83, 0x17, 0x04, 0x24 }, "DS18_01", "Outside", "Online", "" , },
{ { 0x28, 0xff, 0xe3, 0x03, 0x00, 0x17, 0x04, 0xb7 }, "DS18_02", "Zone2", "Online", "" , },
{ { 0x28, 0xff, 0x17, 0x80, 0x00, 0x17, 0x04, 0x5f }, "DS18_03", "Recirc", "Online", "" , },
//etc.
}
I am trying to figure out how to add the myStats capability to this struct. I am trying to avoid having to create multiple separate statistic variables; e.g.
Statistic DS18_01Stats, DS18_02Stats, etc.
When I loop through all of my sensors ideally I could add data something like this;
DS18B20sensors[i].myStats.add(celsius[i]);
But I get a compile error when trying to reference the statistic functions; max, min, count, etc. as follows;
DS18B20sensors[i].myStats.count()
Errors include;
‘myStats’ was not declared in this scope
’Class Statistic’ has no member named 'max’
etc
Thanks in advance for your suggestions