This is an example of using the join network API to join a WiFi network.
#define NETWORK_SSID "\"<YOUR NETWORK NAME HERE>\""
#define NETWORK_PASSWORD "\"<YOUR NETWORK PASSWORD HERE>\""
#include <stdio.h>
#include "target_config.h"
#include "Wiconnect.h"
static Serial consoleSerial(STDIO_UART_TX, STDIO_UART_RX);
int main(int argc, char **argv)
{
consoleSerial.baud(115200);
SerialConfig serialConfig(WICONNECT_RX_PIN, WICONNECT_TX_PIN, 256, NULL);
Wiconnect wiconnect(serialConfig, 256, NULL, WICONNECT_RESET_PIN);
printf("Initializing WiConnect Library...\r\n");
{
{
printf("The WiFi firmware is not supported. Run the ota example to update the firmware:\r\n");
printf("https://developer.mbed.org/teams/ACKme/code/wiconnect-ota_example");
}
else
{
printf("Failed to initialize communication with WiFi module!\r\n"
"Make sure the wires are connected correctly\r\n");
}
for(;;);
}
printf("Joining network: %s....\r\n", NETWORK_SSID);
{
printf("Failed to send join command\r\n");
for(;;);
}
printf("IP Address: %s\r\n", wiconnect.getIpAddress());
printf("Network join example has completed!\r\n");
while(true){}
}