I’ve recently been working on some Photon projects that include DS18 OneWire sensors. I have successfully used the OneWire library and the following lines of code in my project to get temp readings;
byte DS18_01[8] = { 0x28, 0xFF, 0x07, 0x85, 0x83, 0x17, 0x04, 0x24 }; //address of DS18_01 sensor
degF = getTemp(DS18_05);
I would like to use a data structure as follows;
struct device {
byte address;
String label;
String status;
} devices[20]; //up to 20 OneWire DS18 sensors
devices[1].address = 0x28, 0xff, 0x07, 0x85, 0x83, 0x17, 0x04, 0x24;
devices[1].label = "DS18_01";
devices[1].status = "Offline";
I am confused by how to assign a value to the address so that it can be used in this line of code;
degF = getTemp(DS18_05);
I tried degF = getTemp(device[1].address);
This doesn’t work and if I Serial.print the value of device[1].address it is 40.
Thanks in advance for any help & guidance!
Dale