Sample project to connect to AT&T M2X from the STM32 Nucleo + MTS WiFi shield
Dependencies: M2XStreamClient SocketModem jsonlite mbed
Fork of STM32_MTS_Wifi_Connect_M2X by
Diff: main.cpp
- Revision:
- 6:7c2bdcf9d302
- Parent:
- 5:19044863e45c
- Child:
- 8:fa93a2d07116
--- a/main.cpp Sat Jan 04 20:29:00 2014 +0000 +++ b/main.cpp Sat Jan 04 21:02:31 2014 +0000 @@ -14,7 +14,7 @@ //Set the network parameters std::string ssid = "belkin54g"; std::string securityKey = "hackathon"; - Wifi::SecurityType securityType = Wifi::NONE; + Wifi::SecurityType securityType = Wifi::WPA; //Wait for wifi module to boot up for (int i = 10; i >= 0; i = i - 2) { @@ -35,13 +35,10 @@ printf("Set DHCP: %s\n\r", getCodeNames(wifi->setDeviceIP("DHCP")).c_str()); printf("Connect: %s\n\r", wifi->connect() ? "Success" : "Failure"); printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False"); - printf("Ping Server: %s\n\r", wifi->ping("8.8.8.8") ? "Success" : "Failed"); - - //Disconnect from network - printf("Disconnecting...\n\r"); - wifi->disconnect(); - printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False"); - - printf("End Program\n\r"); - while(1); + + //Ping + while (true) { + printf("Ping Server: %s\n\r", wifi->ping("8.8.8.8") ? "Success" : "Failed"); + wait(3); + } }