WebClient

WebClient

The WebClient sketch does a test of the TCP client capability:
  • Initialization
  • Optional SSID Scan (uncomment code section to enable)
  • Access Point connection
  • DHCP address assignment
  • DNS lookup of www.adafruit.com
  • Optional Ping of www.adafruit.com (uncomment code section to enable)
  • Connect to website and print out webpage contents
  • Disconnect
The sketch connects to www.adafruit.com and opens a special webpage we have prepared for this example. It reads the contents of the page and prints that out to the Serial Monitor.

Before you run the sketch, edit it to replace the dummy SSID and password with your own:
#define WLAN_SSID       "yourNetwork"        // cannot be longer than 32 characters!
#define WLAN_PASS       "yourPassword"
Also, make sure that the right wireless security scheme is selected (unsecured, WEP, WPA, or WPA2)
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2
Here's a sample of the Serial Monitor output of WebClient. You should see something similar:
Hello, CC3000!

Free RAM: 1157

Initializing...
Started AP/SSID scan




Connecting to fios63...Waiting to connect...Connected!
Request DHCP

IP Addr: 192.168.1.23
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DHCPsrv: 192.168.1.1
DNSserv: 192.168.1.1
www.adafruit.com -> 207.58.139.247

Connect to 207.58.139.247:80
-------------------------------------
HTTP/1.1 200 OK
Date: Thu, 12 Sep 2013 11:04:02 GMT
Server: Apache
Access-Control-Allow-Origin: http://learn.adafruit.com
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Accept-Encoding, Authorization, Referer, User-Agent
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 1728000
Last-Modified: Thu, 27 Jun 2013 14:13:27 GMT
Accept-Ranges: bytes
Content-Length: 74
Connection: close
Content-Type: text/html

This is a test of the CC3000 module!
If you can read this, its working :)
-------------------------------------


Disconnecting
Once you get this working, you can change the webpage you want to access to any kind of webpage on the Internet
Last updated on 2015-05-04 at 04.24.29 PM Published on 2013-09-16 at 01.57.40 PM