Problem with WiFi connection



  • Hi Forum members,

    I am new to use #LoPy which I bought recently. I was following the tutorials and while setting up the WiFi somehow I totally lost the connection to #LoPy and cannon even able to reset with button provided. What I have done was copying this piece of code to boot.py and restart thats it.

    from network import WLAN
    wlan = WLAN(mode=WLAN.STA)
    nets = wlan.scan()
    for net in nets:
    if net.ssid == 'mywifi':
    print('Network found!')
    wlan.connect(net.ssid, auth=(net.sec, 'mywifikey'), timeout=5000)
    while not wlan.isconnected():
    machine.idle() # save power while waiting
    print('WLAN connection succeeded!')
    break

    Yes, of course, I have edited the file with my #WiFi credentials.

    Let me know what I have done wrong and how I can get the #LoPy again working.

    Thanks in advance.

    Rahul.



  • @RobTuDelft thx for the help.



  • @rahul With the Atom plugin you can specifiy the com port to use in the settings. So you would change the ip-adress to a serial port. Username and password are not needed for serial coms. Under 'More' you can also find the option to 'Find Serial Ports'.



  • @rahul
    as you use G20 i assume you have expansion board
    try connecting by UART
    i do not work with Atom but i suppose there is possibility to change connection from TCP/IP to UART.

    Or use putty or Arduino IDE and there is Commport monitor



  • @RobTuDelft Thanks for the quick reply. Safe boot seems quite tricky as I have lifted up the G20 pin while booting (correct me if I am wrong) and somehow either I cannot do it properly or is not working. About the Atom, how can I access the atom plugin if LoPy is not get connected? At plugin I am getting this error:
    Connecting on 192.168.4.1....
    Connection error: Error: Login time out



  • @rahul You can boot in safe mode, or use Atom plugin for serial communication to still access it. Have you tried that?


Log in to reply
 

Pycom on Twitter