Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions examples/word_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
# WiFi setup
wifi = presto.connect()

# Set the correct time using the NTP service.
ntptime.settime()
# grab the current time from the ntp server and update the Pico RTC
try:
ntptime.settime()
except OSError:
print("Unable to contact NTP server")

def approx_time(hours, minutes):
nums = {0: "twelve", 1: "one", 2: "two",
Expand All @@ -54,11 +57,6 @@ def approx_time(hours, minutes):

def update():
global time_string
# grab the current time from the ntp server and update the Pico RTC
try:
ntptime.settime()
except OSError:
print("Unable to contact NTP server")

current_t = rtc.datetime()
time_string = approx_time(current_t[4] - 12 if current_t[4] > 12 else current_t[4], current_t[5])
Expand Down