frame

can't link to wifi

My project using a Particle Photon was running just okay until some days ago, then I added a function to check the light sensor (perfectly functional when tested alone) and the photon seemed to be a bit overloaded. I put every thread inside an if, so they won't start before a particular value is changed (namely, the date of the day, which needs the wifi connection to be updated).
So when the code arrives to this part:
try:
    # connect to the wifi network (Set your SSID and password below)
    wifi_driver.auto_init()
    for i in range(0,5):
        try:
            wifi.link("name of my smartphone",wifi.WIFI_WPA2,"pw of my smartphone hotspot")
            break
        except Exception as e:
            print("Can't link",e)
    else:
        print("Impossible to link!")
        while True:
            sleep(1000)
the console prints line 9: Can't link IOError @[001A:0013:0000:0147:0000:0000:0000:0000] and when I press this link, nothing happens.
My smartphone hotspot was working perfectly until saturday so I can't figure out how to make the script proceed.
Indeed, the next step is "Trying to connect to time api..." but then I guess everything goes down because it doesn't print anything on the console, not even the exception or "ooops, something very wrong! :(", as it should, looking at the following code.

Comments

  • KikiCS Member
    I solved it: too many threads couldn't be handled and they caused the script to stop being executed altogether; I turned everything into a big "while true:".
Sign In or Register to comment.

ZERYNTH Community

@ 2016 Zerynth.com, all rights reserved.