Xively Jumpstart Demo with WiFly module

Dependencies:   C12832_lcd LM75B MMA7660 WiflyInterface libxively mbed-rtos mbed

Deprecated

This is an mbed 2 example. For an mbed-os WiFi example, see:

[Repository '/teams/mbed-os-examples/code/mbed-os-example-wifi/docs/tip/' not found]

Revision:
12:e07c2779c6fb
Parent:
11:bdf601a405fc
--- a/main.cpp	Mon Oct 14 13:33:04 2013 +0000
+++ b/main.cpp	Fri Oct 25 01:16:49 2013 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "EthernetInterface.h"
+#include "WiflyInterface.h"
 
 #define XI_FEED_ID 128488 // set Xively Feed ID (numerical, no quoutes)
 #define XI_API_KEY "T4KXAH_dasgw1PWBPc3fdsfsdgsdy-dUc4ND0g" // set Xively API key (double-quoted string)
@@ -16,14 +16,14 @@
 MMA7660 axl(p28, p27);
 LM75B tmp(p28, p27);
 C12832_LCD lcd;
+WiflyInterface wifly(p9, p10, p30, p29, "ssid", "password", WPA);
 
 #include "logo.h"
 
 int main() {
     lcd_print_xively_logo();
-    EthernetInterface eth;
     
-    int s = eth.init(); //Use DHCP
+    int s = wifly.init(); //Use DHCP
     
     if( s != NULL )
     {
@@ -31,17 +31,10 @@
         exit( 0 );
     }    
         
-    s = eth.connect();
+    while(!wifly.connect())
+        ;
     
-    if( s != NULL )
-    {
-        lcd_printf( "Could not connect. Will halt!\n" );
-        exit( 0 );
-    }
-    else 
-    {
-        lcd_printf( "IP: %s\n", eth.getIPAddress() );    
-    }
+    lcd_printf( "IP: %s\n", wifly.getIPAddress() );    
     
     xi_feed_t feed;
     memset( &feed, NULL, sizeof( xi_feed_t ) );
@@ -112,6 +105,6 @@
       xi_feed_update( xi_context, &feed );
       lcd_printf( "done...\n" );
       
-      wait( 15.0 );
+      wait( 1.0 );
     }
 }