Hi Gustavo,
Thanks for your interest. I have the deviceID which is a long hex string. What I’m having trouble with is the Serial number, which looks like base 64 encoded, e.g. B40HVN004CTLAEP. The serial number is printed on the outside of the device so it’s easy to see but seems to be hard to retrieve programmatically.
The console has it so it must be coming from somewhere but maybe not visible to the firmware.
Thanks,
Rainer
original post
>
| [gusgonnet](https://community.particle.io/u/gusgonnet) Level 3 | Champion
November 10 |
> - | - |
RainerR:
Can you please add a brief example of how to get the serial number
Hi Rainer,
I’ve never done this before but I was intrigued so I decided to go ahead and search the docs…
This is what I found:
// EXAMPLE USAGE
void setup()
{
// Make sure your Serial Terminal app is closed before powering your device
Serial.begin(9600);
// Wait for a USB serial connection for up to 30 seconds
waitFor(Serial.isConnected, 30000);
String myID = System.deviceID();
// Prints out the device ID over Serial
Log.info("deviceID=%s", myID.c_str());
}
void loop() {}
So the trick is in this line:
String myID = System.deviceID();
Source is here
Cheers!
Gustavo.