0

I am trying to built a clock with rpi pico and circuitpython.

For iot connection I use a WIZNET5K module and so I used the adafruit_wiznet5k library. It connects alright.

The next step is to sync the system occasionally with an NTP server. How do I do this? And do I have a choice as to what server to use? Thus far I have searched and found the esp32 lib which I can't use in this occasion or could I?

In any case when trying to use adafruit_ntp.py I get he error :

File "adafruit_ntp.py", line 49, in init TypeError: Provided object is not an ESP_SPIcontrol object.

Are there any suggestions? Thank you!

1 Answer 1

0

It appears the wiznet5k python library already has an NTP module.

I don't have one to test with, but I think the code to use it would go something like this:

<other imports for setting up wiznet5k>
import adafruit_wiznet5k.adafruit_wiznet5k_ntp as NTP

<other code for setting up wiznet5k>
currenttime = NTP.NTP(eth, "pool.ntp.org", 0)

eth is the configured WIZNET5K device. pool.ntp.org would be the NTP server you choose - you can add country code prefixes, e.g., uk.pool.ntp.org, to get a server closer to home. The third argument is for UTC offset in hours. The function returns seconds since the UNIX epoch (Jan 1 1970).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.