Sync NTP and set RTC od LOPY
-
Re: Syncing RTC To Network Time
Hello,
I tried this code:
import time
import utime
from machine import RTCrtc = machine.RTC()
rtc.ntp_sync("pool.ntp.org")
utime.sleep_ms(750)
print(rtc.now())I only get the 1970 unix time.
What is going wrong?
Can anyone help me? -
Hi @gerkez
Are you connected to a WiFi network when you try to run this code?
You'll need to have the device connected to a network in order to read ntp time.
Cheers,
Alex
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login