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()
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login