The WICED Feather supports the standard Arduino Client interface that is used by many networking boards in the Arduino ecosystem.

Adapting Client Examples

Most existing Client based examples can easily be adapted to work with the WICED Feather board family if the following changes are made to the sketches:

1. Update Header Includes

You will need to change the default WiFi (etc.) headers to the Adafruit versions, as shown below.

Remove Existing Headers

Existing headers like 'WiFi.h', 'WiFiUDP.h', etc., should be removed from the top of your sketch.

For example ...

#include <WiFi.h>
#include <WiFiUdp.h>
#include <WiFiTcp.h>

Add Adafruit WICED Feather Header

... should be replaced with the single 'adafruit_feather.h' header file:

#include <adafruit_feather.h>
Only one header is required with the WICED Feather board family, since the key related headers are also referenced in that one file.

2. Change 'WiFi.*' References to 'Feather.*'

References to functions like WiFi.begin(ssid, pass) or WiFi.available() should be replaced with Feather.begin(ssid, pass) or Feather.available():

Previous Client Code

// Attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
  Serial.print("Attempting to connect to SSID: ");
  // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
  status = WiFi.begin(ssid, pass);

  // wait 10 seconds for connection:

WICED Feather Client Code

Note that at present .begin in the WICED Feather library returns a bool, not a status byte (as in the WiFi example above), so the example has been modified slightly to detect connection status via the .connected function that is also part of the Client interface.

The Adafruit WICED Feather API is still a work in progress and we're trying to make the transition to the WICED as easy as possible, but there may be some implementation differences between platforms. Hopefully these will be addressed over time.
// Attempt to connect to Wifi network
while (!Feather.connected()) {
  Serial.print("Attempting to connect to SSID: ");
  // Connect to any network.
  // The Feather stack will try to determine the network
  // security type automatically
  bool results = Feather.begin(ssid, pass);

  // Optional: wait a bit before checking for a connection

3. Change WiFiUDP and WiFiTCP Class Types

If your example uses classes like WiFiUDP and WiFiTCP, simple replace the class names with AdafruitUDP or AdafruitTCP.

Existing WiFiUDP Class

// A UDP instance to let us send and receive packets over UDP
WiFiUDP Udp;

Updated AdafruitUDP Class

// A UDP instance to let us send and receive packets over UDP
AdafruitUDP Udp;

The UDP and TCP classes should generally be compatible with each other, so simply changing the class type and using the same field name should solve 90% of your problems.

This guide was first published on Mar 23, 2016. It was last updated on Mar 26, 2024.

This page (Client) was last updated on Feb 12, 2016.

Text editor powered by tinymce.