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