Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the synchronization time and make continuous requests in case you can not find server response #58

Closed
arlaor opened this issue Oct 19, 2016 · 4 comments

Comments

@arlaor
Copy link

arlaor commented Oct 19, 2016

Hi.
as indicated by the question as I can make time to upgrade to Internet is not made once every 5 minutes now makes the code TimeNTP_ESP8266WiFi.ino . I want to make the initial sincronization continuously until you connect and synchronize again 24 hours later.
What are the lines of code to be modified?

@blackketter
Copy link

That example is instructive, but check out https://github.com/arduino-libraries/NTPClient

I'm using that with the following code:

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);

time_t ntpSyncProvider() {
  return timeClient.getEpochTime();
}

and then in setup():

  timeClient.begin();
  timeClient.setTimeOffset(timeZoneOffset);

  setSyncProvider(&ntpSyncProvider);
  setSyncInterval(5);

and in loop():

  timeClient.update();

@arlaor
Copy link
Author

arlaor commented Oct 19, 2016

Hi @blackketter in the related example I not find the parameters used for the hours, minutes and seconds, everything happens outside the code.
I want to use the example for my project that is turn on at certain days, every hour of the day, a relay and keep it on for a few minutes. So I need to manipulate the variables of time to do, but they do not appear in the code example.
I have reviewed the library NTPClient.h but neither appear.

@blackketter
Copy link

If you use my sample code above you can have the Time library use the NTPClient to synchronize the time and then the Time library functions to figure out what day or time it is now.

Beyond this, your question isn't really a bug for the Time library and so should be asked in another forum somewhere.

@arlaor
Copy link
Author

arlaor commented Oct 20, 2016

unfortunately I could not make timelib.h or time.h library assume the values of year month day hour minutes seconds.
forgiveness for having overlooked the forum rules.
I appreciate your cooperation.
I tried to follow some other example that fits my needs

@arlaor arlaor closed this as completed Oct 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants