LoPy crash on run script from pymakr
When I run a complete script (from the docs) in one piece, my connection to the lopy freezes and I need to reboot the lopy and pymakr to get a signal again.
Is this normal or am I doing something wrong?
I just got the lopy in today so this might be a rookie mistake :)
The sample script I tried to run is:
from network import WLAN wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() print("Scanning for networks") for net in nets: print('Network found! '+net.ssid)
When I run the first two lines and then the last four, the script works fine.
Ralph last edited by
@George FIY: Besides the passive mode, the lopy can only handle one connection at a time, which you also need to configure in FileZilla (see this chapter in the docs). I'm guessing WinSCP might have this as a default setting, making it work out of the box :)
@nickparrin FileZilla is going out the door.. WinSCP did the trick right out-of-the-box! even took the sites config from filezilla.
@George have you tried turning passive mode on/off (in the ftp client) to see if that makes ftp work?
@nickparrin I understood that part of the code!
@George my experience is that the AccesPoint mode of the Py is kinda buggy, so it froze here as well sometimes. I just booted it, quickly overwrote the file I pasted above and got connected to my own WIFI, then it became stable.
Boot.py is empty the the very first time you boot the lopy, apart from some comments.
You seem to have it already working, but the script above needs the ssid/password for your own network changed in <ssid> and <password>.
I got it connected to my network, but not really in the way @nickparrin described.
I created a new project in pymakr and saved a new boot.py file with the content supplied below. Clicked on Sync and the boot.py was saved to the lopy in a "No guts, no glory!" kind of way hoping that a factory reset would recover the boot.py if I bricked that.
The code in the topic-start was in the main.py file and was surprised to see that after a restart the lopy connected to my wifi and a few seconds later printed the "Network Found! " list!
@livius the response of uname() is:
(sysname='LoPy', nodename='LoPy', release='0.9.4.b1', version='bc42ea7 on 2016-11-14', machine='LoPy with ESP32')
@nickparrin I first tried as a backup to download flash/boot.py but it freezes, is that normal? Just try overwriting it without backup of the original?
same here when I tried to paste the code below.
What I did was, connect to the wifi access point (192.168.4.1) and upload it via ftp to flash/boot.py . wifi is kinda spotty here, but once you have connected it to your own wifi network it seems to be fluent.
# code block import machine import os import time uart = machine.UART(0, 115200) os.dupterm(uart) if machine.reset_cause() != machine.SOFT_RESET: from network import WLAN # Put your network SSID and password here. You can use multiple networks, this script will try to connect to any of them, if it fails, it will fallback to AP mode known_nets = [('<ssid>', '<password>')] wl = WLAN() original_ssid = wl.ssid() original_auth = wl.auth() wl.mode(WLAN.STA) available_nets = wl.scan() nets = frozenset([e.ssid for e in available_nets]) known_nets_names = frozenset([e for e in known_nets]) net_to_use = list(nets & known_nets_names) try: net_to_use = net_to_use pwd = dict(known_nets)[net_to_use] sec = [e.sec for e in available_nets if e.ssid == net_to_use] wl.connect(net_to_use, (sec, pwd), timeout=10000) # Timeout for connection, change this if you require a different timeout (ms) print(wl.ifconfig()) except: wl.init(mode=WLAN.AP, ssid=original_ssid, auth=original_auth, channel=6, antenna=WLAN.INT_ANT) print("sleeping 10 seconds..") time.sleep(10) print("ip config") print(wl.ifconfig())
you will see the dhcp ip in the pymkr console :)
There is a big sticker on the box saying I need to update firmware first, so after connecting the antenna and usb cable in the extension board I updated the firmware successfully (from windows, sorry , not everyone is perfect)
I will get the version tomorrow morning!
livius last edited by
what firmware version?
you can check it by:
import os os.uname()
the latest you can download from: