forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
This is a modified version of the bitcoin example:
from adafruit_magtag.magtag import MagTag
DATA_SOURCE = "https://api.coindesk.com/v1/bpi/currentprice.json"
DATA_LOCATION = ["bpi", "USD", "rate_float"]
magtag = MagTag(
url=DATA_SOURCE,
json_path=DATA_LOCATION,
)
magtag.network.connect()
resp = magtag.fetch()
print("Bitcoin =", resp)
which is saved as fetch_test.py
to the MagTag's CIRCUITPY
folder. Then, connect to REPL and:
Adafruit CircuitPython 6.1.0-beta.0-13-g3e6661bc9 on 2020-11-19; MagTag with ESP32S2
>>> import fetch_test
Connecting to AP ----
Retrieving data...Reply is OK!
Bitcoin = 18023.4
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.1.0-beta.0-13-g3e6661bc9 on 2020-11-19; MagTag with ESP32S2
>>> import fetch_test
Connecting to AP ----
hard resets
Metadata
Metadata
Assignees
Labels
No labels