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

    Network Module object does not have attribute LAN

    Bug Report
    1
    1
    1.7k
    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.
    • M5StickFreaklerM
      M5StickFreakler
      last edited by

      I would like to use my M5Stack as a http Server. That works great with internal WiFi, but not via Ethernet.
      The solution is programmed in Micropython.

      The following code does not work on my M5Stack Fire with W5500 Base Module:
      --> line 4: in <module> AttributeError: 'module' object has no attribute 'LAN'

      import network
      import socket

      lan = network.LAN(mdc=23, mdio=18, power=21, phy_type=network.PHY_W5500, phy_addr=0)

      lan.ifconfig(('192.168.50.108', '255.255.255.0', '192.168.50.1', '255.255.255.0'))
      lan.active(True)

      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      sock.bind(('192.168.50.108', 8080))

      sock.listen(1)
      while True:
      conn, addr = sock.accept()
      print('Connection from:', addr)
      conn.sendall('Hello, world!')
      conn.close()

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