Skip to content

Hard reset on second use of wifi (MagTag / ESP32S2) #3726

@caternuson

Description

@caternuson

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions