Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # stm32 version of wiznet_connect.py
- import network
- nic = network.Ethernet()
- while not nic.isconnected():
- pass
- nic.active(True)
- nic.ifconfig('dhcp')
- print(nic.ifconfig())
- import socket
- print(socket.getaddrinfo('micropython.org', 80))
- # usage of static ip address
- nic.ifconfig(('192.168.0.123','255.255.255.0','192.168.0.1','192.168.0.1'))
- print(nic.ifconfig())
- # ascii art star wars
- addr = socket.getaddrinfo("towel.blinkenlights.nl", 23)[0][-1]
- s = socket.socket()
- s.connect(addr)
- while True:
- data = s.recv(500)
- print(str(data, 'utf8'), end='')
Add Comment
Please, Sign In to add comment