LoPy crash on run script from pymakr
-
Hi,
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.
-
what firmware version?
you can check it by:import os os.uname()the latest you can download from:
Firmwares -
Hi Livius,
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!
-
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[0] for e in known_nets]) net_to_use = list(nets & known_nets_names) try: net_to_use = net_to_use[0] pwd = dict(known_nets)[net_to_use] sec = [e.sec for e in available_nets if e.ssid == net_to_use][0] 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 :)
good luck.
-
@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?
-
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!
-
@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>.
-
@nickparrin I understood that part of the code!
But even with the lopy on my own network I wasn't able to download boot.py and main.py
(Desktop is windows/filezilla) I can connect and list directories but not download -
@George have you tried turning passive mode on/off (in the ftp client) to see if that makes ftp work?
-
@nickparrin FileZilla is going out the door.. WinSCP did the trick right out-of-the-box! even took the sites config from filezilla.
-
@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 :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login