![](/media/cache/group/arm_mbed.PNG.50x50_q85.png)
LED Demo for Tech Con 2014
Dependencies: EthernetInterface PololuLedStripx mbed-rtos mbed nanoservice_client_1_12_X
Fork of LPC1768_LWM2M_Client by
Diff: main.cpp
- Revision:
- 5:fcfba34d1aeb
- Parent:
- 4:71b211dbe14c
- Child:
- 7:59c7b96ace5b
--- a/main.cpp Sun Sep 28 01:00:23 2014 +0000 +++ b/main.cpp Sun Sep 28 03:12:33 2014 +0000 @@ -11,8 +11,6 @@ //#define LED_COUNT 120 rgb_color colors[LED_COUNT]; -extern "C" void mbed_mac_address(char *mac); - Serial pc(USBTX, USBRX); // tx, rx // **************************************************************************** @@ -67,6 +65,8 @@ UDPSocket server; Endpoint nsp; +char * ipstring; +char * uid; static void nsp_init() { @@ -75,9 +75,18 @@ nsp.set_address(NSP_ADDRESS, NSP_PORT); - mbed_mac_address(mac); - sprintf(macstring, "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - strncat(endpoint_name, macstring, 12); + ipstring = eth.getIPAddress(); + uid = ipstring; + + while(*ipstring) + { + if(*ipstring =='.') + *ipstring='-'; + ipstring++; + + } + strncat( endpoint_name, uid, strlen(uid) ); + pc.printf("\r\nep name: %s\r\n", endpoint_name); NSDL_DEBUG("name: %s", endpoint_name); NSDL_DEBUG("NSP=%s - port %d\n", NSP_ADDRESS, NSP_PORT);