Connect to SSID, get ip by dhcp, ping google.com, display statistics
Dependencies: NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed
Revision 5:864a193bd778, committed 2013-10-08
- Comitter:
- Kojto
- Date:
- Tue Oct 08 15:12:24 2013 +0000
- Parent:
- 4:52e1684bf322
- Child:
- 6:76465a08f5c1
- Commit message:
- Update host driver to rev 35
Changed in this revision
--- a/cc3000_hostdriver_mbedsocket.lib Thu Oct 03 16:06:37 2013 +0000 +++ b/cc3000_hostdriver_mbedsocket.lib Tue Oct 08 15:12:24 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Kojto/code/cc3000_hostdriver_mbedsocket/#30b6ed7bf8fd +http://mbed.org/users/Kojto/code/cc3000_hostdriver_mbedsocket/#9dd909fb7caf
--- a/main.cpp Thu Oct 03 16:06:37 2013 +0000 +++ b/main.cpp Tue Oct 08 15:12:24 2013 +0000 @@ -66,11 +66,11 @@ * \return none */ void connect_to_ssid(char *ssid, char *key, unsigned char sec_mode) { - printf("Connecting to SSID: %s. Timeout is 10s.\n",ssid); + printf("Connecting to SSID: %s. Timeout is 10s. \r\n",ssid); if (wifi.connect_to_AP((uint8_t *)ssid, (uint8_t *)key, sec_mode) == true) { - printf(" Connected\n"); + printf(" Connected. \r\n"); } else { - printf(" Connection timed-out (error). Please restart.\n"); + printf(" Connection timed-out (error). Please restart. \r\n"); while(1); } } @@ -99,11 +99,12 @@ user_info.FTC = 1; wifi.set_user_file_info((uint8_t *)&user_info, sizeof(user_info)); wifi._wlan.stop(); - printf("FTC finished.\n"); + printf("FTC finished. \r\n"); } -/** Ping a site - * \param none +/** + * \brief Ping a site + * \param none * \return int */ int main() { @@ -156,7 +157,7 @@ uint8_t add3 = (ip >> 0); printf("IP address of %s: %d:%d:%d:%d \r\n", site, add0, add1, add2, add3); } else { - printf("Failed"); + printf("Failed. \r\n"); } printf("Starting sending ping. \r\n");
--- a/main.h Thu Oct 03 16:06:37 2013 +0000 +++ b/main.h Tue Oct 08 15:12:24 2013 +0000 @@ -32,9 +32,9 @@ #define USE_SMART_CONFIG 0 // Default SSID Settings -#define AP_KEY "test" +#define AP_KEY "zxcvbnm,./" #define AP_SECURITY WPA2 // WPA2 must be enabled for use with iPhone or Android phone hotspot! -#define SSID "test" +#define SSID "SSID" void init();