User Manual

// Print all software versions
Feather.printVersions();
// Try to connect to an AP
while ( !connectAP() )
{
delay(500); // delay between each attempt
}
// Connected: Print network info
Feather.printNetwork();
// Tell the HTTP client to auto print error codes and halt on errors
http.err_actions(true, true);
// Set the callback handlers
http.setReceivedCallback(receive_callback);
http.setDisconnectCallback(disconnect_callback);
// Connect to the HTTP server
Serial.printf("Connecting to %s port %d ... ", SERVER, PORT);
http.connect(SERVER, PORT); // Will halt if an error occurs
Serial.println("OK");
// Setup the HTTP request with any required header entries
http.addHeader("User-Agent", USER_AGENT_HEADER);
http.addHeader("Accept", "text/html");
http.addHeader("Connection", "keep-alive");
// Send the HTTP request
Serial.printf("Requesting '%s' ... ", PAGE);
http.get(SERVER, PAGE); // Will halt if an error occurs
Serial.println("OK");
}
/**************************************************************************/
/*!
@brief The loop function runs over and over again
*/
/**************************************************************************/
void loop()
{
togglePin(ledPin);
delay(250);
}
/**************************************************************************/
/*!
@brief Connect to the defined access point (AP)
*/
/**************************************************************************/
bool connectAP(void)
{
// Attempt to connect to an AP
Serial.print("Attempting to connect to: ");
Serial.println(WLAN_SSID);
if ( Feather.connect(WLAN_SSID, WLAN_PASS) )
{
Serial.println("Connected!");
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 98 of 202