The ntpTest sketch does a test of the library's SNTP (Simple Network Time Protocol) client:
  • Initialization
  • SSID Scan
  • Access Point connection
  • DHCP address assignment
  • SNTP time synchronization
  • Extract and print current time and date
The sntp client performs a time synchronization with servers from us.pool.ntp.org and pool.ntp.org. You can also optionally provide it the addresses of one or two of your own time servers. The ntpTest sketch tries time.nist.gov first, before falling back to one of the pool servers.

The client also breaks out the synchronized network time into a structure containing current date and time fields. The sketch formats and prints this information to the Serial Monitor.
To avoid unnecessary loading of NTP servers, please perform the time synchronization as infrequently as possible. Once per day or longer should be plenty to maintain reasonably accurate time.
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)
Here's a sample of the Serial Monitor output of ntpTest. You should see something similar:
      Hello, CC3000!

Free RAM: 843

Initialising the CC3000 ...
Firmware V. : 1.19

Deleting old connection profiles

Attempting to connect to fios63
Started AP/SSID scan

Connecting to fios63...Waiting to connect...Connected!
Request DHCP
Current local time is:
Thursday, September 12, 2013
Day of year: 255

Closing the connection

This guide was first published on Sep 16, 2013. It was last updated on Sep 16, 2013.

This page (ntpTest) was last updated on Sep 12, 2013.

Text editor powered by tinymce.