Connect to a NTP server
Go to file
FWeinb 056b9b4110 Merge pull request #7 from pnewb/master
Adding support for getting numerical day of the week where 0 = Sunday
2016-03-31 12:24:50 +02:00
examples Remove .begin() from API 2015-12-12 17:21:39 +01:00
keywords.txt Adding support for getting numerical day of the week where 0 = Sunday 2016-03-30 22:26:04 -07:00
library.json Add to platformio 2015-12-29 14:34:16 +01:00
library.properties Update to 2.0 2015-12-12 17:22:21 +01:00
NTPClient.cpp Adding support for getting numerical day of the week where 0 = Sunday 2016-03-30 22:26:04 -07:00
NTPClient.h Adding support for getting numerical day of the week where 0 = Sunday 2016-03-30 22:26:04 -07:00
README.md Update README.md 2015-12-12 22:19:03 +01:00

NTPClient

Connect to a NTP server, here is how:

#include <NTPClient.h>
#include <ESP8266WiFi.h>

const char *ssid     = "<SSID>";
const char *password = "<PASSWORD>";

// By default 'time.nist.gov' is used.
NTPClient timeClient;

// You can specify the time server pool and the offset, (in seconds)
// additionaly you can specify the update interval (in milliseconds).
// NTPClient timeClient("europe.pool.ntp.org", 3600, 60000);

void setup(){
  Serial.begin(11520);
  WiFi.begin(ssid, password);

  while ( WiFi.status() != WL_CONNECTED ) {
    delay ( 500 );
    Serial.print ( "." );
  }

}

void loop() {
  timeClient.update();
  
  Serial.println(timeClient.getFormattedTime());
  
  delay(1000);
}