I am trying to expose a OneWire Address via Spark.Variable.
Typically I am used to printing the OneWire Address through the Serial port by doing this:
sensors.getAddress(dev, i);
for (uint8_t i = 0; i < 8; i++) {
// Pads 0 if address value is less than 16
if (dev[i] < 16) {
Serial.print("0");
}
// Prints Address Value
Serial.print(dev[i], HEX);
if (i <= 6) {
Serial.print("-");
}
}
So instead of showing the address on the serial port. I want to be able to expose it by using the Spark.Variable. But I am struggling.
char address[15];
in Setup() I do:
Spark.variable("address", &address, STRING);
Then I tried the following but no success:
sprintf(address,"%s", dev);
or
strcpy(address, dev);
But still no luck.
Any tips would be awesome! Thanks