• 0 Votes
    4 Posts
    62 Views
    D
    @robert-hh Thanks I agree busy-waiting is bad, my understanding was that machine.idle() would give other threads/interrupts the opportunity to run. That code was added to aid the debugging, to see activity while waiting for the network layer to configure itself. I've substituted your code but unfortunately it hasn't changed the networking behaviour - still no IP layer connectivity.
  • WiFi not working out of the box

    LoPy wlan
    5
    0 Votes
    5 Posts
    230 Views
    robert-hhR
    @mbivans It seems to me that your problem was cause by PyBytes. You cango back to V1.20.2rc6, and once you have the REPL open, issue the commands: import pycom pycom.pybytes_on_boot(False) That setting survives reboot and power cycling, and will result in performing the expected and documented behavior.
  • 0 Votes
    2 Posts
    180 Views
    robert-hhR
    @jc_serg If you are looking for a ping.py script: there is one here: https://gist.github.com/91cc8979e33e82af6d99ec34c38195fb.git
  • Adhoc WiFi broadcast?

    GPy gpy wlan
    3
    0 Votes
    3 Posts
    284 Views
    K
    That's the problem, I tried to use sockets but the wrong way. I think I should be trying for a UDP broadcast? So the diagnostics go out regardless of the phone being connected or not import socket; import time addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1] s = socket.socket(); s.bind(addr); s.listen(1) print('listening on', addr) while 1: cl, addr = s.accept() print('client connected from', addr) cl.send('a diagnostic print \r') time.sleep(2) cl.send('another diagnostic print \r') time.sleep(2) cl.close() If the phone looses the adhoc wifi connection the program just sits there waiting for a client to connect.
  • Wlan Probleme

    WiPy 2&3 wipy lopy wlan network
    4
    0 Votes
    4 Posts
    329 Views
    W
    @robert-hh Thanks for the info. Always rescued it via software. Will test it with machine Deepsleep
  • Issue Resolved: WiFi connection using 192.168.4.1

    FiPy wlan 192.168.4.1
    4
    0 Votes
    4 Posts
    715 Views
    D
    @throwaway Re: Issue: WiFi connection using 192.168.4.1 Thanks much. Per suggest AP mode was not O, manual wlan.init(), did the trick, and its working: >>> import pycom >>> from network import WLAN >>> wlan=WLAN() >>> wlan.mode() 2 >>> wlan.init() >>> wlan.mode() 1 >>> wlan.ssid() 'lopy-wlan-4080' >>> wlan.auth() (3, 'www.pycom.io') >>> Thanks much!!
  • 0 Votes
    4 Posts
    603 Views
    R
    @mfalkvidd, @Paul-Thornton thank you for taking care of this! I am looking forward to a solution as soon as possible. Not only my project strongly depends on this function as it is a rather basic functionality. At least, I could not find any alternative way of detecting connected devices in AP mode.
  • wlan.isconnected() not working in AP mode

    MicroPython wlan ap mode lopy4
    2
    0 Votes
    2 Posts
    382 Views
    P
    Do the connected clients also return false or is it just the node setup as an AP
  • 0 Votes
    5 Posts
    888 Views
    P
    @martijnthe Intresting. my guess would have been a weird thread race between your thread and our code that deals with setting up wifi on boot. But if its still happening with that's disabled I'd guess its something else. Ill raise it in tomorrows standup and see if anyone else know's anything about it.
  • UDP broadcast

    Discussion broadcast wlan
    4
    -2 Votes
    4 Posts
    840 Views
    P
    Receiving broadcasts yes. Sending, no.
  • WiPy broadcasts AP when in STA mode

    Issues & Bugs wipy wlan wifi ap mode sta mode
    3
    0 Votes
    3 Posts
    625 Views
    H
    @jcaron Thank you very much for your reply. Turning off WiFi on boot seems to fix the issue. Apparently it was related to the PyCom starting in AP mode for telnet.
  • How to restart WLAN connection?

    LoPy lopy4 lopy-wlan wlan wlan.station
    1
    0 Votes
    1 Posts
    529 Views
    No one has replied
  • REPL via WLAN.STA server

    LoPy wlan dupterm telnet
    3
    0 Votes
    3 Posts
    803 Views
    L
    Thanks. If I set os.dupterm(None), I get a telnet login on WLAN which works OK ('Login succeeded!), but no REPL '>>>' on WLAN (or UART0) as might be expected. micropython.org indicates dupterm requires a stream_object. I have tried the obvious wlan and server instances without success. What is the relevant object here?
  • 0 Votes
    1 Posts
    832 Views
    No one has replied
  • Send a file from one Lopy to another Lopy

    LoPy lopy to lopy wlan wifi lopy
    27
    0 Votes
    27 Posts
    8k Views
    Z
    Good again. I return to post, because I would need the LoPy that receives the txt file is the one that starts the wifi as wlan = WLAN (mode = WLAN.AP, ssid = 'Gateway1', auth = (WLAN.WPA2, 'password'), antenna = WLAN.INT_ANT) I have tried to modify the code as I have the partner that works so that it is but I get error everywhere. Once trying once more, if I do not restart the board and try to execute the code, I always get the error: Traceback (most recent call last): File "<stdin>", line 17, in <module> OSError: [Errno 12] ENOMEM Because it is ? If someone can give me a hand code please! Capture Errors: [image: 1528129559872-f1.png] [image: 1528129567703-f2.png] used code: Server And Wifi AP: from network import WLAN import socket import select import time #Setup WiFi AP wlan = WLAN(mode=WLAN.AP, ssid='Gateway1', auth=(WLAN.WPA2,'password'), antenna=WLAN.INT_ANT) port = 12345 s = socket.socket() s.bind(socket.getaddrinfo("0.0.0.0", port)[0][4]) s.listen(1) print("Running server") while True: cl, remote_addr = s.accept() cl.setblocking(True) print("Client connection from:", remote_addr) file = "/flash/registro2.txt" with open(file, 'wb') as f: try: data = s.recv(1024) print(data) f.write(data) except TimeoutError: break Client and Lopy and in charge to send file: from network import WLAN import socket import select import machine import time # Abrimos wifi wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() for net in nets: if net.ssid == 'Gateway1': print('Network found!') wlan.connect(net.ssid, auth=(net.sec, 'password'), timeout=5000) while not wlan.isconnected(): machine.idle() # save power while waiting print('WLAN connection succeeded!') break else: raise Exception("WiFi network not found") # sleep just to make sure the wifi is connected time.sleep(1) ip, subnet, gateway, dns = wlan.ifconfig() # Connect to server # Bind to the port port = 12345 s = socket.socket() s.connect((gateway, port)) s.setblocking(True) s.settimeout(2) while True: readable, writable, errored = select.select([s], [], []) for s in readable: cl, remote_addr = s.accept() cl.setblocking(True) print("Client connection from:", remote_addr) file = "/flash/registro.txt" print("Sending: ", file) with open(file, 'rb') as f: data = f.read(1024) while(data): print("sending", data) cl.sendall(data) data = f.read(1024) print("Done Sending") cl.close()
  • WiFi Scan - security models is there a mapping

    Discussion wlan scan
    3
    0 Votes
    3 Posts
    948 Views
    ahaw021A
    @livius thank you muchly
  • 0 Votes
    2 Posts
    882 Views
    sebS
    Hi, Thanks for the feedback, I will definitely make this information clearer with our upcoming documentation refresh.
  • What is OSError 118?

    Discussion wlan udp socket
    5
    1 Votes
    5 Posts
    2k Views
    A
    @livius That was my first guess but I've dropped the power to the lowest possible level (15%) and it's as far away as I can make it. I have counted 90 Wi-Fi signals in the area though, which is staggering!
  • Timeout for wlan.connect()

    SiPy wlan
    10
    1 Votes
    10 Posts
    3k Views
    R
    @livius said in Timeout for wlan.connect(): @administrators @daniel i see in sources that timeout is currently silently ignored - passed to wlan_do_connect but not used and in sources is // TODO Add timeout handling!! will be good to have something like wlan.istimeout() and then above loop can be changed to: while not wlan.isconnected() or not wlan.istimeout(): machine.idle() # save power while waiting An 'wlan.istimeout()' would seem like a good suggestion! How can we check currently if there was a timeout occuring?
  • No reconnection

    WiPy 2&3 wipy 2.0 wlan
    1
    0 Votes
    1 Posts
    763 Views
    No one has replied