UT 03: Reading Serial ID
This example shows how to read the unique serial ID number

Required Materials

1 x Waspmote 1 x Battery 1 x MiniUSB wire

Notes

This example can be executed in Waspmote v12 and Waspmote v15

Code

1
/*
2
* ------ [Ut_03] Waspmote reading unique serial ID number --------
3
*
4
* Explanation: This example shows how to read the unique serial ID number
5
*
6
* Copyright (C) 2017 Libelium Comunicaciones Distribuidas S.L.
7
* http://www.libelium.com
8
*
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see .
21
*
22
* Version: 3.1
23
* Design: David Gascón
24
* Implementation: Marcos Yarza
25
*/
26
27
28
void setup()
29
{
30
// Init USB
31
USB.ON();
32
33
// Show '_serial_id' stored by the API when powering up
34
USB.print(F("Global variable '_serial_id':"));
35
USB.printHex(_serial_id[0]);
36
USB.printHex(_serial_id[1]);
37
USB.printHex(_serial_id[2]);
38
USB.printHex(_serial_id[3]);
39
USB.printHex(_serial_id[4]);
40
USB.printHex(_serial_id[5]);
41
USB.printHex(_serial_id[6]);
42
USB.printHex(_serial_id[7]);
43
USB.println();
44
delay(1000);
45
}
46
47
void loop()
48
{
49
// Reading the serial number
50
Utils.readSerialID();
51
52
USB.print(F("Waspmote serial ID: "));
53
USB.printHex(_serial_id[0]);
54
USB.printHex(_serial_id[1]);
55
USB.printHex(_serial_id[2]);
56
USB.printHex(_serial_id[3]);
57
USB.printHex(_serial_id[4]);
58
USB.printHex(_serial_id[5]);
59
USB.printHex(_serial_id[6]);
60
USB.printHex(_serial_id[7]);
61
USB.println();
62
delay(1000);
63
}
64
Copied!

Output

1
H#
2
Global variable '_serial_id':4D3C7063D93742F4
3
Waspmote serial ID: 4D3C7063D93742F4
4
Waspmote serial ID: 4D3C7063D93742F4
5
Waspmote serial ID: 4D3C7063D93742F4
6
Waspmote serial ID: 4D3C7063D93742F4
Copied!
Last modified 1yr ago