26 #define WEB_SETUP_SSID "\"WiConnect WebSetup Example\""
30 #define WEB_SETUP_PASSWORD "password"
43 #include "target_config.h"
45 #include "Wiconnect.h"
52 static void webSetupCompleteCallback(
WiconnectResult result,
void *arg1,
void *arg2);
61 static Serial consoleSerial(STDIO_UART_TX, STDIO_UART_RX);
64 static uint8_t wiconnectInternalBuffer[256];
67 static volatile bool webSetupCompleteFlag =
false;
73 int main(
int argc,
char **argv)
75 consoleSerial.baud(115200);
84 SerialConfig serialConfig(WICONNECT_RX_PIN, WICONNECT_TX_PIN, 256, NULL);
88 Wiconnect wiconnect(serialConfig,
sizeof(wiconnectInternalBuffer), wiconnectInternalBuffer, WICONNECT_RESET_PIN);
95 printf(
"Initializing WiConnect Library...\r\n");
102 printf(
"The WiFi firmware is not supported. Run the ota example to update the firmware:\r\n");
103 printf(
"https://developer.mbed.org/teams/ACKme/code/wiconnect-ota_example");
107 printf(
"Failed to initialize communication with WiFi module!\r\n"
108 "Make sure the wires are connected correctly\r\n");
118 printf(
"Starting Websetup...\r\n");
123 printf(
"Failed to start web setup\r\n");
131 printf(
"Web setup has started.\r\n\r\n");
132 printf(
"1. Using your phone (or PC, Mac, Linux, etc.)\r\n connect to the WiFi network: %s\r\n", WEB_SETUP_SSID);
133 printf(
"2. The password is: %s\r\n", WEB_SETUP_PASSWORD);
134 printf(
"3. Once connected, open your browser and enter the URL: http://setup.com\r\n");
135 printf(
"4. This will bringup a setup page, enter your router's credentials.\r\n");
136 printf(
"5. Click the 'Save & Exit' button at the bottom of the webpage\r\n\r\n");
138 while(!webSetupCompleteFlag)
149 printf(
"IP Address: %s\r\n", wiconnect.getIpAddress());
150 printf(
"Web setup example has completed!\r\n");
158 static void webSetupCompleteCallback(
WiconnectResult result,
void *arg1,
void *arg2)
160 webSetupCompleteFlag =
true;
WiconnectResult
API Result code.
Generic callback function.
Host<->Wiconnect Module serial configuration.
The WiFi module's firmware is out-dated. See updateFirmware() to update the firmware.
Command successfully completed.
The root WiConnect library class. This class inheriets all WiConnect functionality.