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 socketlan = 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()