User Manual

Serial.print("Attempting to connect to: ");
Serial.println(WLAN_SSID);
if ( Feather.connect(WLAN_SSID, WLAN_PASS) )
{
Serial.println("Connected!");
}
else
{
Serial.printf("Failed! %s (%d)", Feather.errstr(), Feather.errno());
Serial.println();
}
Serial.println();
return Feather.connected();
}
void setup()
{
Serial.begin(115200);
// wait for Serial port to connect. Needed for native USB port only
while (!Serial) delay(1);
Serial.println("UDP Echo Callback Example");
Serial.println();
while( !connectAP() )
{
delay(500);
}
// Tell the UDP client to auto print error codes and halt on errors
udp.err_actions(true, true);
udp.setReceivedCallback(received_callback);
Serial.printf("Openning UDP at port %d ... ", LOCAL_PORT);
udp.begin(LOCAL_PORT);
Serial.println("OK");
Serial.println("Please use your PC/mobile and send any text to ");
Serial.print( IPAddress(Feather.localIP()) );
Serial.print(" UDP port ");
Serial.println(LOCAL_PORT);
}
void loop()
{
}
/**************************************************************************/
/*!
@brief Received something from the UDP port
*/
/**************************************************************************/
void received_callback(void)
{
int packetSize = udp.parsePacket();
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 92 of 202