Skip to content

Commit a807d0f

Browse files
committed
Updated quote example to use deep sleep instead of a loop.
1 parent b6421ef commit a807d0f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

examples/magtag_quote_demo.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44
import os
5-
import time
65
from adafruit_magtag.magtag import MagTag
76

87
# Set up where we'll be fetching data from
@@ -55,10 +54,9 @@ def add_hyphen(author_name):
5554
text_transform=add_hyphen,
5655
)
5756

58-
while True:
59-
try:
60-
value = magtag.fetch()
61-
print("Response is", value)
62-
except (ValueError, RuntimeError) as e:
63-
print("Some error occured, retrying! -", e)
64-
time.sleep(180)
57+
try:
58+
value = magtag.fetch()
59+
print("Response is", value)
60+
except (ValueError, RuntimeError) as e:
61+
print("Some error occured, retrying! -", e)
62+
magtag.exit_and_deep_sleep(60)

0 commit comments

Comments
 (0)