![](/media/cache/profiles/77143919d1234297079f075357988f3b.50x50_q85.jpg)
Very short program to GET the MAC Address of MBED,
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 extern "C" void mbed_mac_address(char *s); 00004 00005 // -> http://mbed.org/forum/mbed/topic/972/?page=1#comment-10318 00006 00007 DigitalOut myled(LED1); 00008 Serial pc(USBTX, USBRX); 00009 00010 int main() 00011 { 00012 uint64_t uid = 0; 00013 char mmac[6]; 00014 char mac[6]; 00015 00016 pc.baud(921600); 00017 00018 pc.printf ("\r\nTrying to read My MAC Address ..\r\n"); 00019 00020 mbed_mac_address(mac); 00021 uid = mac[0] << 40 | mac[1] << 32 | 00022 mac[2] << 24 | mac[3] << 16 | 00023 mac[4] << 8 | mac[5] << 0; 00024 00025 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]); 00026 00027 00028 while (1) { 00029 myled = 1; 00030 wait(0.2); 00031 myled = 0; 00032 wait(0.2); 00033 } 00034 } 00035 00036
Generated on Wed Jul 13 2022 19:59:41 by
![doxygen](doxygen.png)