Wiznet makers

Aimee0

Published December 04, 2023 ©

17 UCC

10 WCC

8 VAR

0 Contests

0 Followers

0 Following

Original Link

Arduino NTP library for W5100 ethernet web server

The project uses W5100-ntp, an NTP library for Arduino that uses a W5100 Ethernet board. W5100-ntp is implemented in C++.

COMPONENTS Hardware components

Arduino - Arduino UNO

x 1


WIZnet - W5100 ethernet shield

x 1


PROJECT DESCRIPTION

Project overview

This project is an example of using Arduino to connect to the network through the Ethernet W5100 module, and importing the current time through the NTP server.

The purpose of this example is to implement the ability for the Arduino device to maintain accurate time and respond to the current time as requested by the web client.

 

NTP library

The w5100-ntp library is a code that implements Network Time Protocol (NTP) communication using the W5100 chip using the C++ language.

 

Interface

  • EthernetNtp::EthernetNtp()
    • The generator method is called when an object in the class is created.
  • void EthernetNtp::begin(IPAddress &addr, time_t syncInterval)
    • W5100 method to initialize chip and network settings. Call this method to perform the initial setup.
  • time_t EthernetNtp::getNtpTime(void)
    • A method that communicates with the NTP server to obtain the current time.
    • The parameter ntpServer represents the address of the NTP server.
    • The return value is the Unix time, which represents the current time.
  • void EthernetNtp::sendNTPpacket(IPAddress &address)
    • A method of sending an NTP packet requesting time information to the NTP server.
    • The parameter ntpServer represents the address of the NTP server.
  • char* EthernetNtp::formattedTime(char *s, size_t maxsize, const char *format)
    • A method that serves to formalize time and return it to a string.

 

 

Documents
  • henri bachetti

Comments Write