User Manual
/* This sketch connects to the Adafruit IO server at io.adafruit.com
* and updates a 'PHOTOCELL_FEED' every 5 seconds.
*
* It also follow 'ONOFF_FEED' to receive updates from the AIO server via
* the built-in follow/subscribe callback handler.
*
* To run this demo
* 1. Change WLAN_SSID/WLAN_PASS
* 2. Decide whether you want to use TLS/SSL or not (USE_TLS)
* 3. Change AIO_USERNAME, AIO_KEY to match your own account details
* 4. If you want, change PHOTOCELL_FEED and ONOFF_FEED to use different feeds
* 5. Compile and run
* 6. Optionally log into the AIO webserver to see any changes in data, etc.
*/
#define WLAN_SSID "yourSSID"
#define WLAN_PASS "yourPass"
#define AIO_USERNAME "...your AIO username (see https://accounts.adafruit.com)..."
#define AIO_KEY "...your AIO key..."
// AdafruitAIO will auto append the "username/feeds/" prefix to your feed(s)
#define PHOTOCELL_FEED "photocell"
#define ONOFF_FEED "onoff"
// Connect using TLS/SSL or not
#define USE_TLS 0
// Uncomment to set your own ClientID, otherwise a random ClientID is used
//#define CLIENTID "Adafruit Feather"
AdafruitAIO aio(AIO_USERNAME, AIO_KEY);
AdafruitAIOFeed photocell (&aio, PHOTOCELL_FEED);
AdafruitAIOFeed onoff (&aio, ONOFF_FEED);
int value = 0;
/**************************************************************************/
/*!
@brief The setup function runs once when the board comes out of reset
*/
/**************************************************************************/
void setup()
{
Serial.begin(115200);
// Wait for the USB serial port to connect. Needed for native USB port only
while (!Serial) delay(1);
Serial.println("AIO Test Example\r\n");
// Print all software versions
Feather.printVersions();
while ( !connectAP() )
{
delay(500); // delay between each attempt
}
// Connected: Print network info
Feather.printNetwork();
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 140 of 202










