WiFi.macAddress(mac);
String PostData="submission={\"DeviceID\":\"";
PostData=String(PostData+mac[5]);PostData=PostData+":";
PostData=String(PostData+mac[4]);PostData=PostData+":";
PostData=String(PostData+mac[3]);PostData=PostData+":";
PostData=String(PostData+mac[2]);PostData=PostData+":";
PostData=String(PostData+mac[1]);PostData=PostData+":";
PostData=String(PostData+mac[0]);
PostData=PostData+"\",";
PostData=PostData+"\"RSSI\":\"";
PostData=String(PostData+rssi);
PostData=PostData+"\"}";
Serial.println(PostData);
This returns as a series of numbers:
submission={"DeviceID":"217:126:163:52:254:24","RSSI":"-44"}
However, I believe it should be something much more akin to this:
00:0a:95:9d:68:16 (example only)
I tried including ",HEX" in the String(), unfortunately it fails to compile. I'm not getting an error, it simply hangs on compilation, as illustrated in the example code below:
PostData=String(PostData+mac[2],HEX);PostData=PostData+":";
I realize this is more of a Arduino question, less of a ESP8266 question -- but I was hoping someone could offer a simple fix. If anyone has experience combining strings and sees any improvements I could make, even that would be greatly appreciated.