How to print the MAC address of an mbed to the dispBoB

Dependencies:   dispBoB mbed PCA9635

Committer:
d_worrall
Date:
Mon Jul 11 15:05:07 2011 +0000
Revision:
1:4012148564b2

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
d_worrall 1:4012148564b2 1 #include "mbed.h"
d_worrall 1:4012148564b2 2 #include "dispBoB.h"
d_worrall 1:4012148564b2 3 #include "stdio.h"
d_worrall 1:4012148564b2 4
d_worrall 1:4012148564b2 5 dispBoB db(p28, p27, p26); //object instantiation
d_worrall 1:4012148564b2 6 extern "C" int mbed_mac_address(char *);
d_worrall 1:4012148564b2 7
d_worrall 1:4012148564b2 8 int main() {
d_worrall 1:4012148564b2 9 uint64_t uid = 0;
d_worrall 1:4012148564b2 10 char mac[6];
d_worrall 1:4012148564b2 11 mbed_mac_address(mac); //this copies the MAC address into the
d_worrall 1:4012148564b2 12 uid = mac[0] << 40 | mac[1] << 32 | //variable 'uid'
d_worrall 1:4012148564b2 13 mac[2] << 24 | mac[3] << 16 |
d_worrall 1:4012148564b2 14 mac[4] << 8 | mac[5] << 0;
d_worrall 1:4012148564b2 15 char MACAddressBuffer[9];
d_worrall 1:4012148564b2 16 sprintf(MACAddressBuffer, "%x", uid); //convert type uint64_t --> char* (format hex)
d_worrall 1:4012148564b2 17 db.scroll(MACAddressBuffer, 0.2); //scroll foramtted MAC address across dispBoB
d_worrall 1:4012148564b2 18 }