Very short program to GET the MAC Address of MBED,

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ceri
Date:
Thu Mar 01 15:03:27 2012 +0000
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r a8ba8da3c18b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 01 15:03:27 2012 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+extern "C" void mbed_mac_address(char *s);
+
+// -> http://mbed.org/forum/mbed/topic/972/?page=1#comment-10318
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX); 
+
+int main() 
+{
+    uint64_t uid = 0;
+    char mmac[6];
+    char mac[6];
+
+    pc.baud(921600);
+
+    pc.printf ("\r\nTrying to read My MAC Address ..\r\n");
+
+    mbed_mac_address(mac);
+    uid = mac[0] << 40 | mac[1] << 32 |
+          mac[2] << 24 | mac[3] << 16 |
+          mac[4] << 8  | mac[5] << 0;
+
+    pc.printf ("Here it is .. %02x %02x %02x %02x %02x %02x !\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+
+
+    while (1) {
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+    }
+}
+
+
diff -r 000000000000 -r a8ba8da3c18b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 01 15:03:27 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593