Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordclock - Removed double call to ntptime.settime #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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