ntpTest

ntpTest

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)
// 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 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
UpdateNTPTime
Current local time is:
7:18:52.65445
Thursday, September 12, 2013
Day of year: 255


Closing the connection
    
Last updated on 2015-05-04 at 04.24.29 PM Published on 2013-09-16 at 01.57.40 PM