![](/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:
- 4:71b211dbe14c
- Parent:
- 3:e3aa908cbb51
- Child:
- 5:fcfba34d1aeb
--- a/main.cpp Sun Sep 28 00:09:18 2014 +0000 +++ b/main.cpp Sun Sep 28 01:00:23 2014 +0000 @@ -11,6 +11,8 @@ //#define LED_COUNT 120 rgb_color colors[LED_COUNT]; +extern "C" void mbed_mac_address(char *mac); + Serial pc(USBTX, USBRX); // tx, rx // **************************************************************************** @@ -31,15 +33,17 @@ static const char* NSP_ADDRESS = "23.99.99.252"; // barista.cloudapp.net //static const char* NSP_ADDRESS = "192.168.1.200"; static const int NSP_PORT = 5683; -char endpoint_name[24] = "mbed-LED-booth-1"; +char endpoint_name[24] = "LED-booth-"; uint8_t ep_type[] = {"mbed_device"}; uint8_t lifetime_ptr[] = {"60"}; +char mac[6]; +char macstring[13] ; + // **************************************************************************** // Ethernet initialization EthernetInterface eth; - static void ethernet_init() { @@ -71,6 +75,10 @@ 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); + NSDL_DEBUG("name: %s", endpoint_name); NSDL_DEBUG("NSP=%s - port %d\n", NSP_ADDRESS, NSP_PORT);