Skip to content

Commit fe3a06f

Browse files
committed
Updated bitcoin example to update every 60 seconds + first try
1 parent fbe2a3c commit fe3a06f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

examples/bitcoin_demo.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ def text_transform(val):
3434
magtag.preload_font(b"$012345789") # preload numbers
3535
magtag.preload_font((0x00A3, 0x20AC)) # preload gbp/euro symbol
3636

37-
timestamp = time.monotonic()
37+
timestamp = None
3838

3939
while True:
40-
if (time.monotonic() - timestamp) > 5: # once a second...
40+
if not timestamp or (time.monotonic() - timestamp) > 60: # once every 60 seconds...
4141
try:
4242
value = magtag.fetch()
4343
print("Response is", value)
4444
except (ValueError, RuntimeError) as e:
4545
print("Some error occured, retrying! -", e)
4646
timestamp = time.monotonic()
47-
48-
time.sleep(0.01)

0 commit comments

Comments
 (0)