import time
import wifi
import ntptime
time.sleep(0.1) # Wait for USB to become ready
wifi.wifi_connect()
print("Hello, Pi Pico W!")
# Set the NTP server (optional, default is often fine)
# ntptime.host = "pool.ntp.org"
# Synchronize the time
# Sync time
ntptime.host = "time.nist.gov"
try:
print("Syncing with NTP server...")
ntptime.settime()
print("Time synchronized.")
except OSError as e:
print("Error syncing time:", e)
#ntptime.settime()
print(time.localtime())Loading
pi-pico-w
pi-pico-w