Skip to content

Commit 2926b90

Browse files
authored
Merge pull request #82 from makermelissa/main
Updated quote example to use deep sleep instead of a loop
2 parents a188c77 + a807d0f commit 2926b90

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

examples/magtag_quote_demo.py

+6-8
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)