Closed Type-32 closed 1 month ago
OK so a few things...
Did you read the MicroPython documentation?? I am guessing not. That module seems to only be referenced in the documentation for the ESP8266. Not sure if it would apply to the ESP32 or not. The other thing is if we follow the directions for the ESP8266 you are using it incorrectly.
from machine import RTC
rtc = RTC()
rtc.datetime((2017, 8, 23, 1, 12, 48, 0, 0)) # set a specific date and time
rtc.datetime() # get date and time
# synchronize with ntp
# need to be connected to wifi <<<< IMPORTANT
import ntptime
ntptime.settime() # set the rtc datetime from the remote server
rtc.datetime() # get the date and time in UTC
you see the line marked with "IMPORTANT"???
Oh shoot, my bad 🥶
no worries. sometimes things do get overlooked. I am going to make the assumption that the module does in fact work with the ESP32 because it is available. I think you just forgot that you are trying to set the time using a "network" time server and you overlooked connecting the ESP to a network.
Library ntptime gives
OSError -202
when invoking the methods in it, methods such assettime()
andtime()
.Full REPL Log: