Search found 7 matches

by Mark.Calaway
Thu Aug 16, 2018 5:43 pm
Forum: General Discussion and Questions
Topic: network connect issue
Replies: 8
Views: 4778

Re: network connect issue

kevinkk525 wrote:
Thu Aug 16, 2018 3:36 pm
I meant try this:

Code: Select all

while not sta_if.isconnected():
        time.sleep_ms(100)
oh thx, it works!
Why in the doc is not mentioned?
by Mark.Calaway
Thu Aug 16, 2018 1:51 pm
Forum: General Discussion and Questions
Topic: network connect issue
Replies: 8
Views: 4778

Re: network connect issue

If i reboot stop the board by REPL with CTRL+C, the board reset and the code run correctly.

Is it a sort of bug? :shock:
by Mark.Calaway
Thu Aug 16, 2018 10:19 am
Forum: General Discussion and Questions
Topic: network connect issue
Replies: 8
Views: 4778

Re: network connect issue

kevinkk525 wrote:
Thu Aug 16, 2018 9:44 am
try putting a sleep in the loop like time.sleep_ms(100).
# ------ MAIN
json_load()
time.sleep_ms(100)
do_connection()

Still not working...
by Mark.Calaway
Thu Aug 16, 2018 9:21 am
Forum: General Discussion and Questions
Topic: network connect issue
Replies: 8
Views: 4778

network connect issue

Hi everyone, i notified that strange issue in my similar codes, both load the information from the same json file: Example one: with open('document.json') as data_file: # pay attention, load NOT loads data = ujson.load(data_file) data_file.close() yourWifiSSID = data["wifi"]["SSD"] yourWifiPassword ...
by Mark.Calaway
Mon Oct 30, 2017 8:07 pm
Forum: ESP8266 boards
Topic: Load json
Replies: 6
Views: 9442

Re: Load json

[quote=SpotlightKid post_id=22857 time=1509390816 user_id=552] This should be: [code] with open(filename) as fp: data = ujson.loads(fp.read()) [/code] The [i]readlines[/i] method of file objects returns the contents of the file as a list of lines (strings), which is not what we want here. But contra...
by Mark.Calaway
Mon Oct 30, 2017 4:21 pm
Forum: ESP8266 boards
Topic: Load json
Replies: 6
Views: 9442

Re: Load json

[quote="benalb"] The docs says: ujson.loads(str), Parse the JSON str and return an object. Raises ValueError if the string is not correctly formed. so, you must pass the content of data_file as a string: data = ujson.loads(str(data_file.readlines())) [/quote] Thx, i have another question: i need to ...
by Mark.Calaway
Sun Oct 29, 2017 4:29 pm
Forum: ESP8266 boards
Topic: Load json
Replies: 6
Views: 9442

Load json

Hi guys, I would like to load some parameters from a json file. I wrote an example: # mqtt.py : import ujson with open('document.json') as data_file: data = ujson.loads(data_file) yourWifiSSID = data["wifi"]["SSD"] yourWifiPassword = data["wifi"]["password"] print('SSD: {} & pass: {}',yourWifiSSID,y...