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 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
Text editor powered by tinymce.