Use NTPClient Library to Obtain Local Time

by daphwl in Circuits > Arduino

4 Views, 0 Favorites, 0 Comments

Use NTPClient Library to Obtain Local Time

NTPclient.jpg

Ameba RTL8722DM

Ameba RTL8722DM is a low-power dual-band WLAN and BLE(Bluetooth Low Energy) SoC by Realtek. The RTL8722DM also include memory for Wi-Fi protocol functions and application making it simple for anyone to develop various kind of IoT applications. At the same time it has a wide range of peripheral interfaces. With all these interfaces, it can connect to most of the electronics components like LEDs, temperature and humidity sensors, and so on.

Supplies

AmebaD [RTL8722DM / RTL8722CSM / RTL8722DM_MINI] x1

Programming

NTPclient1.png
NTPclient2.png

In this example, we use an NTP client to sync with NTP servers using UDP and keep track of time locally. Open the example. "File"→"Examples"→"NTPclient"→ "Advanced"

Modify the highlighted code section (ssid,password) to connect to your WiFi network.

Final Result

NTPclient3.png

Compile the code and upload it to Ameba. After pressing the reset button, Ameba Connects to WiFi, gets the UTC time from the NTP server, amd prints out the current time with time zone offset to the serial monitor.

For More Resources

If you need additional technical documents or the source code for this project. Please visit the official websites and join the Facebook group and forum.

Ameba Official Website: https://www.amebaiot.com/en/

Ameba Facebook Group: https://www.facebook.com/groups/amebaioten

Ameba Forum: https://forum.amebaiot.com/