🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    uiflow: usocket module does not work if upload a sketch through the "download"

    UIFlow
    2
    3
    5.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      torabora
      last edited by torabora

      I have a problem: the usocket module does not work if upload a sketch through the "download" item in the uiflow IDE.
      Here's an example of sketch:

      from m5stack import lcd
      import usocket as socket

      lcd.clear()
      lcd.setCursor(0, 0)
      lcd.setColor(lcd.WHITE)

      try:
      addr = socket.getaddrinfo('micropython.org', 80)[0][-1]
      s = socket.socket()
      s.connect(addr)
      s.send(b'GET / HTTP/1.1\r\nHost: micropython.org\r\n\r\n')
      data = s.recv(1000)
      s.close()
      lcd.println("OK\n")
      lcd.print("Data len: " + str(len(data)))

      except:
      lcd.print("Got Error!")

      If you upload by button with the triangle icon (looks like play) - it works, data received. If uploaded on the M5 through download - always fails.

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3 @torabora
        last edited by

        @torabora what do you mean by doesn't work.
        if you restart the m5stack, can you run the app from the app menu?

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • T
          torabora
          last edited by

          @ajb2k3 The app starts after reboot M5 Fire, but the code is triggered in the exception block and displays message "Got Error!".

          1 Reply Last reply Reply Quote 0
          • First post
            Last post