
demo of the murata wifi chip. This demo tries to connect to an open wifi access point and prints out all the relevant information about the connection. It then scans all wifi access points nearby and reports their information.
Dependencies: SNICInterface mbed-rtos mbed
Fork of SNIC-xively-jumpstart-demo by
Revision 14:6d58d3855feb, committed 2014-05-26
- Comitter:
- kishino
- Date:
- Mon May 26 06:28:29 2014 +0000
- Parent:
- 13:d4a21765a203
- Child:
- 15:abc12b228291
- Commit message:
- Created demo application for Xively using the SNIC with TypeYD.
Changed in this revision
--- a/EthernetInterface.lib Fri Nov 08 16:57:17 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/SNICInterface.lib Mon May 26 06:28:29 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/murata/code/SNICInterface/#6a0ba999597d
--- a/libxively.lib Fri Nov 08 16:57:17 2013 +0000 +++ b/libxively.lib Mon May 26 06:28:29 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/xively/code/libxively/#4ce6299f7535 +http://mbed.org/users/xively/code/libxively/#1208875310d3
--- a/main.cpp Fri Nov 08 16:57:17 2013 +0000 +++ b/main.cpp Mon May 26 06:28:29 2014 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" -#include "EthernetInterface.h" +#include "SNIC_WifiInterface.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) +#define XI_FEED_ID 1056160623 // set Xively Feed ID (numerical, no quoutes) +#define XI_API_KEY "Wg7CfZDrj7VjIIpiYzdDrMow6wdENAOGjkIfQ0fUjJh6DAw2" // set Xively API key (double-quoted string) #include "app_board_io.h" @@ -19,30 +19,61 @@ #include "logo.h" +#if 0 +#define DEMO_AP_SSID "HWD11_E8088BD5E3A8" +#define DEMO_AP_SECURITY_TYPE e_SEC_WPA2_AES +#define DEMO_AP_SECUTIRY_KEY "aArGrg303DG5HA9" +#define DEMO_AP_SECUTIRY_KEY_LEN 15 +#else +//#define DEMO_AP_SSID "muRata1" +//#define DEMO_AP_SECURITY_TYPE e_SEC_WPA2_AES +//#define DEMO_AP_SECUTIRY_KEY "12345678" +//#define DEMO_AP_SECUTIRY_KEY_LEN 8 + +#define DEMO_AP_SSID "Test" +#define DEMO_AP_SECURITY_TYPE e_SEC_WPA2_AES +#define DEMO_AP_SECUTIRY_KEY "eightspot" +#define DEMO_AP_SECUTIRY_KEY_LEN 9 +#endif +/** Wi-Fi SNIC UART Interface*/ +C_SNIC_WifiInterface mSNICwifi( p9, p10, NC, NC, p30 ); +Serial pc(USBTX, USBRX); + int main() { + pc.baud( 115200 ); + printf("main\r\n"); lcd_print_xively_logo(); - EthernetInterface eth; - int s = eth.init(); //Use DHCP + // Initialize Wi-Fi interface + int s = mSNICwifi.init(); - if( s != NULL ) + lcd_printf("init();\r\n"); + + if( s != 0 ) { lcd_printf( "Could not initialise. Will halt!\n" ); - exit( 0 ); + return -1; } - s = eth.connect(); + wait(0.5); + mSNICwifi.disconnect(); + lcd_printf("disconnect();\r\n"); - if( s != NULL ) + wait(0.5); + // Connect AP + s = mSNICwifi.connect( DEMO_AP_SSID + , strlen(DEMO_AP_SSID) + , DEMO_AP_SECURITY_TYPE + , DEMO_AP_SECUTIRY_KEY + , DEMO_AP_SECUTIRY_KEY_LEN ); + lcd_printf("connect();\r\n"); + if( s != 0 ) { lcd_printf( "Could not connect. Will halt!\n" ); - exit( 0 ); + return -1; } - else - { - lcd_printf( "IP: %s\n", eth.getIPAddress() ); - } - + wait(0.5); + xi_feed_t feed; memset( &feed, NULL, sizeof( xi_feed_t ) ); @@ -112,6 +143,6 @@ xi_feed_update( xi_context, &feed ); lcd_printf( "done...\n" ); - wait( 15.0 ); + wait( 1.0 ); } }
--- a/mbed-rtos.lib Fri Nov 08 16:57:17 2013 +0000 +++ b/mbed-rtos.lib Mon May 26 06:28:29 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#ee87e782d34f +http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
--- a/mbed.bld Fri Nov 08 16:57:17 2013 +0000 +++ b/mbed.bld Mon May 26 06:28:29 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file