3 #include "target_config.h"
5 #define NETWORK_SSID "<YOUR NETWORK SSID HERE>"
6 #define NETWORK_PASSWORD "<YOUR NETWORK PASSWORD HERE>"
8 #define ECHO_SERVER_ADDRESS "192.168.1.110"
9 #define ECHO_SERVER_PORT 7
12 static Serial consoleSerial(STDIO_UART_TX, STDIO_UART_RX);
14 static char in_buffer[256];
19 SerialConfig serialConfig(WICONNECT_RX_PIN, WICONNECT_TX_PIN, 256);
20 Wiconnect wiconnect(serialConfig, 256, NULL, WICONNECT_RESET_PIN);
22 consoleSerial.baud(115200);
26 printf(
"Failed to initialize Wiconnect: %s\r\n", Wiconnect::getWiconnectResultStr(result));
29 printf(
"The WiFi firmware is not supported. Run the ota example to update the firmware:\r\n");
30 printf(
"https://developer.mbed.org/teams/ACKme/code/wiconnect-ota_example");
34 else if(
WICONNECT_FAILED(result, wiconnect.join(NETWORK_SSID, NETWORK_PASSWORD)))
36 printf(
"Failed to join network: %s\r\n", Wiconnect::getWiconnectResultStr(result));
45 echo_server.set_address(ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT);
48 char out_buffer[] =
"Hello World\n";
49 if(sock.sendTo(echo_server, out_buffer,
sizeof(out_buffer)) == -1)
51 printf(
"Failed to send data\r\n");
56 int n = sock.receiveFrom(echo_server, in_buffer,
sizeof(in_buffer));
59 printf(
"Failed to receive data\r\n");
63 printf(
"%s", in_buffer);
WiconnectResult
API Result code.
Host<->Wiconnect Module serial configuration.
The WiFi module's firmware is out-dated. See updateFirmware() to update the firmware.
The root WiConnect library class. This class inheriets all WiConnect functionality.
#define WICONNECT_FAILED(result, func)
Populates result with return value from func, returns TRUE if return value contains error...