This example (located in Adafruit_WICED_Arduino/examples/WiFi) will perform a DNS lookup based on the specified domain name or IP address.

Setup

Set your AP details using the WLAN_SSID and WLAN_PASS flags, setting them to the values used by you own access point:

      #define WLAN_SSID             "YOUR SSID HERE"
#define WLAN_PASS             "YOUR SSID KEY HERE"
    

Set the domain name or the IP address that you wish the resolve using the following variables:

// target by hostname
const char target_hostname[] = "adafruit.com";

// target by IP String
const char target_ip_str[] = "8.8.8.8";

Compile and Flash

You can then compile and flash your sketch to the WICED Feather using the 'Download' arrow icon at the top of the IDE:

You should see the USB DFU progress as the update advances, and there will be a 'Done Uploading' message in the top left of the status bar when you are done:

Testing the Sketch

Wait a few seconds for the USB CDC serial interface to enumerate, and then open the Serial Monitor using either the Serial Monitor icon in the upper-right of the IDE or via Tools > Serial Monitor:

This will cause the WICED Feather to attempt to connect to the access point, and then it will attempt to look up the specified domain or IP address:

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

This page (GetHostByName) was last updated on Feb 11, 2016.

Text editor powered by tinymce.