User Manual

#define SERVER "wifitest.adafruit.com" // The TCP server to connect to
#define PAGE "/testwifi/index.html" // The HTTP resource to request
#define PORT 80 // The TCP port to use
// Some servers such as Facebook check the user_agent header to
// return data accordingly. Setting 'curl' mimics a command line browser.
// For a list of popular user agents see: http://www.useragentstring.com/pages/useragentstring.php
#define USER_AGENT_HEADER "curl/7.45.0"
int ledPin = PA15;
// Use the HTTP class
AdafruitHTTP http;
/**************************************************************************/
/*!
@brief TCP/HTTP received callback
*/
/**************************************************************************/
void receive_callback(void)
{
// If there are incoming bytes available
// from the server, read then print them:
while ( http.available() )
{
int c = http.read();
Serial.write( (isprint(c) || iscntrl(c)) ? ((char)c) : '.');
}
}
/**************************************************************************/
/*!
@brief TCP/HTTP disconnect callback
*/
/**************************************************************************/
void disconnect_callback(void)
{
Serial.println();
Serial.println("---------------------");
Serial.println("DISCONNECTED CALLBACK");
Serial.println("---------------------");
Serial.println();
http.stop();
}
/**************************************************************************/
/*!
@brief The setup function runs once when the board comes out of reset
*/
/**************************************************************************/
void setup()
{
Serial.begin(115200);
// Wait for the USB serial to connect. Needed for native USB port only.
while (!Serial) delay(1);
Serial.println("HTTP Get Example (Callback Based)\r\n");
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 97 of 202