How to print the MAC address of an mbed to the dispBoB
Dependencies: dispBoB mbed PCA9635
Diff: main.cpp
- Revision:
- 0:483d5a8daac0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jul 11 15:04:02 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