How can i get a core's name or ID?

Hi!

I have two Spark Cores, Jake and Elwood, that run the same code, reporting thermometer values over MQTT. I need each core to report their name (or any unique identifier) to the MQTT broker on my LAN.

Is there a function that pulls any ID from a Core which i could use, something like the Electric Imp’s hardware.getdeviceid()? Will i find help in the topic https://community.spark.io/t/get-core-id-over-wifi/783/2 , which honestly speaking, it a bit over my head? Or is this a job for Spark Variables, so that the ID is stored in the cloud for each Core?

atb,
~rL

Try this for the core’s device id as an Arduino String class object:

String myIDStr = Spark.deviceID();
2 Likes

Thank you! I must not have read the API docs very well because i didn’t see that one before.