Xively Jumpstart Demo with WiFly module
Dependencies: C12832_lcd LM75B MMA7660 WiflyInterface libxively mbed-rtos mbed
Fork of xively-jumpstart-demo by
Revision 12:e07c2779c6fb, committed 2013-10-25
- Comitter:
- MACRUM
- Date:
- Fri Oct 25 01:16:49 2013 +0000
- Parent:
- 11:bdf601a405fc
- Child:
- 13:b5092350e231
- Commit message:
- Changed network connection from ethernet to Wifly module
Changed in this revision
--- a/EthernetInterface.lib Mon Oct 14 13:33:04 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#cba86db5ab96
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WiflyInterface.lib Fri Oct 25 01:16:49 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/mbed/code/WiflyInterface/#9d18ac47d27f
--- 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 ); } }