LED Demo for Tech Con 2014

Dependencies:   EthernetInterface PololuLedStripx mbed-rtos mbed nanoservice_client_1_12_X

Fork of LPC1768_LWM2M_Client by MBED_DEMOS

Revision:
11:3e5ac016a106
Parent:
10:5ecaf86d3936
Child:
14:25430e88728f
--- a/main.cpp	Tue Sep 30 03:31:19 2014 +0000
+++ b/main.cpp	Sat Oct 04 04:57:21 2014 +0000
@@ -1,12 +1,13 @@
 #include "mbed.h"
-#include "EthernetInterface.h"
+#include "WiflyInterface.h"
 #include "nsdl_support.h"
 #include "dbg.h"
+
 // Include resources
 #include "light.h"
-#include "IAP.h"
 #include "PololuLedStrip.h"
-PololuLedStrip ledStrip(P0_4);
+
+PololuLedStrip ledStrip(D2);
 //#define LED_COUNT 60
 #define LED_COUNT 120
 rgb_color colors[LED_COUNT];
@@ -25,36 +26,13 @@
 #define MASK    "255.255.255.0"
 #define GW      "10.0.0.1"
 
-extern "C" void mbed_mac_address(char *mac)
-{
-    static char buf[64] = {0};
-    IAP iap;
-    int32_t *block = iap.read_serial();
-    uint32_t serial_number[5] = {0};
-    
-    memset(buf, 0, sizeof(buf));
-    serial_number[0] = *(block);
-    serial_number[1] = *(block+1);
-    // we only want bottom 16 bits of word1 (MAC bits 32-47)
-    // and bit 9 forced to 1, bit 8 forced to 0
-    // Locally administered MAC, reduced conflicts
-    // http://en.wikipedia.org/wiki/MAC_address
-    //serial_number[0] |= 0x00000200;
-    //serial_number[0] &= 0x0000FEFF;
-    memcpy(mac, (uint8_t*) &serial_number[0], 6);
-    mac[0] |= 0x02;
-    mac[0] &= 0xFE;
-    mac[5] |= 0x02;
-    mac[5] &= 0xFE;
-     
-    // snprintf(buf, 16, "%4X%08X", serial_number[0], serial_number[1]);
-}  
 
  
 // NSP configuration
 /* Change this IP address to that of your NanoService Platform installation */
 //static const char* NSP_ADDRESS = "217.140.101.20"; /* public mbed demo server */ 
-static const char* NSP_ADDRESS = "23.99.99.252"; // barista.cloudapp.net
+static const char* NSP_ADDRESS = "54.228.25.31"; //leshan sandbox
+//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] = "LED-booth-";
@@ -64,7 +42,9 @@
 // ****************************************************************************
 // Ethernet initialization
 
-EthernetInterface eth;
+//EthernetInterface eth;
+WiflyInterface eth(D1, D0, D5, LED1, "demo", "ARMDEMO1", WPA);
+
 static void ethernet_init()
 {
     /* Initialize network */
@@ -76,7 +56,7 @@
     eth.init(IP, MASK, GW);
     NSDL_DEBUG("eth.init\r\n");
 #endif
-    if(eth.connect(30000) == 0)
+    if(eth.connect() == 0)
         pc.printf("Connect OK\n\r");
 
     NSDL_DEBUG("IP Address:%s ", eth.getIPAddress());