Network card not available on Lopy



  • Re: OSError: Network card not available

    I am getting the same error as the referenced thread, but I just cannot seem to find what I'm doing wrong here. I'm using a Lopy and I'm simply trying to do a get request to an url just for testing. Here is my boot.py:

    from machine import UART
    import machine
    import os
    
    uart = UART(0, baudrate=115200)
    os.dupterm(uart)
    
    machine.main('main.py')
    

    .. and here's my main:

    from network import WLAN
    import urequests as requests
    import machine
    import time
    
    SSID = 'Altibox099473'
    PASSWORD = 'SeKmLeMk'
    
    wlan = WLAN(mode=WLAN.STA)
    wlan.antenna(WLAN.INT_ANT)
    
    # Assign your Wi-Fi credentials
    wlan.connect(SSID, auth=(WLAN.WPA2, PASSWORD), timeout=5000)
    
    while not wlan.isconnected ():
        machine.idle()
    print("Connected to Wifi\n")
    
    try:
        res = requests.get("https://jsonplaceholder.typicode.com/todos/1")
        print(res)
        pass
    except Exception as e:
        print("Request failed: " + str(e))
        pass
    

    I'm using urequests found here: https://github.com/jotathebest/micropython-lib/blob/master/urequests/urequests.py

    Really appreciate some help. Thanks!



  • Ok I finally got this to work! I was using the pycom fw upgrade tool tol flash my device with what I thought was the latest fw. Flashed my device with version 1.18.0 and it worked like a charm (latest version did not work, giving me another error..)

    Why doesn't the firmware update tool flash the latest version?


Log in to reply
 

Pycom on Twitter