Connections to Xively working; has 5 channels on Xively (axl_x, axl_y, axl_z, heater_status, temperature)

Dependencies:   C12832_lcd EthernetInterface LM75B MMA7660 NTPClient libxively mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
wren301
Date:
Sat May 31 21:39:53 2014 +0000
Parent:
4:05986b9ea330
Commit message:
Wifly attempt, can't get IP

Changed in this revision

WiflyInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WiflyInterface.lib	Sat May 31 21:39:53 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/WiflyInterface/#c4e238de0b3b
--- a/main.cpp	Mon May 19 15:40:00 2014 +0000
+++ b/main.cpp	Sat May 31 21:39:53 2014 +0000
@@ -5,9 +5,13 @@
 #include "LM75B.h"
 #include "MMA7660.h"
 #include "Websocket.h"
+#include "WiflyInterface.h"
 
 #define PST_OFFSET  7*60*60
 
+Serial pc(USBTX, USBRX);
+WiflyInterface wifly(p9, p10, p25, p26, "mbed", "password", WPA);
+
 Ticker timer;
 C12832_LCD lcd; //Graphics LCD
 EthernetInterface eth; //Networking functions
@@ -27,19 +31,11 @@
 
 void connectToTheInternet()
 {
-    eth.init(); //Init and use DHCP
-    wait(2);
-    lcd.cls();
-    lcd.printf("Getting IP Address\r\n");
-    printf("\n\rGetting IP Address\r\n");
-    if(eth.connect(60000)!=0) {
-        lcd.printf("DHCP error - No IP");
-        wait(10);
-    } else {
-        lcd.printf("IP is %s\n", eth.getIPAddress());
-        printf("IP is %s\n", eth.getIPAddress());
-        wait(2);
-    }
+    wifly.init(); // use DHCP
+    while (!wifly.connect()); // join the network
+    printf("\n\rIP Address is %s\n\r", wifly.getIPAddress());
+    lcd.printf("IP is %s\n", eth.getIPAddress());
+    wait(5);
     lcd.cls();
 }
 
@@ -99,6 +95,7 @@
 int main()
 {
     connectToTheInternet();
+    
     //Variable to hold the current minute so we only update the display when the minute changes
     char currentMinute[2];
     currentMinute[1] = 'a';
@@ -168,5 +165,5 @@
     } else {
         lcd.printf("NTP Error\r\n");
     }
-    eth.disconnect();
+    wifly.disconnect();
 }
\ No newline at end of file