How to print the MAC address of an mbed to the dispBoB
Dependencies: dispBoB mbed PCA9635
Revision 1:4012148564b2, committed 2011-07-11
- Comitter:
- d_worrall
- Date:
- Mon Jul 11 15:05:07 2011 +0000
- Parent:
- 0:483d5a8daac0
- Commit message:
Changed in this revision
macAddress.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show diff for this revision Revisions of this file |
diff -r 483d5a8daac0 -r 4012148564b2 macAddress.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macAddress.cpp Mon Jul 11 15:05:07 2011 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "dispBoB.h" +#include "stdio.h" + +dispBoB db(p28, p27, p26); //object instantiation +extern "C" int mbed_mac_address(char *); + +int main() { + uint64_t uid = 0; + char mac[6]; + mbed_mac_address(mac); //this copies the MAC address into the + uid = mac[0] << 40 | mac[1] << 32 | //variable 'uid' + mac[2] << 24 | mac[3] << 16 | + mac[4] << 8 | mac[5] << 0; + char MACAddressBuffer[9]; + sprintf(MACAddressBuffer, "%x", uid); //convert type uint64_t --> char* (format hex) + db.scroll(MACAddressBuffer, 0.2); //scroll foramtted MAC address across dispBoB +} \ No newline at end of file
diff -r 483d5a8daac0 -r 4012148564b2 main.cpp --- a/main.cpp Mon Jul 11 15:04:02 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "mbed.h" -#include "dispBoB.h" -#include "stdio.h" - -dispBoB db(p28, p27, p26); //object instantiation -extern "C" int mbed_mac_address(char *); - -int main() { - uint64_t uid = 0; - char mac[6]; - mbed_mac_address(mac); //this copies the MAC address into the - uid = mac[0] << 40 | mac[1] << 32 | //variable 'uid' - mac[2] << 24 | mac[3] << 16 | - mac[4] << 8 | mac[5] << 0; - char MACAddressBuffer[9]; - sprintf(MACAddressBuffer, "%x", uid); //convert type uint64_t --> char* (format hex) - db.scroll(MACAddressBuffer, 0.2); //scroll foramtted MAC address across dispBoB -} \ No newline at end of file