Network Module object does not have attribute LAN

  • 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(('', '', '', ''))

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

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