Skip to content

Commit ab41a20

Browse files
committed
fix ipconfig example use of encode
1 parent f4481be commit ab41a20

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/esp32spi_ipconfig.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
print("WiFi secrets are kept in secrets.py, please add them there!")
1616
raise
1717

18+
HOSTNAME = "esp32-spi-hostname-test"
19+
1820
IP_ADDRESS = "192.168.1.111"
1921
GATEWAY_ADDRESS = "192.168.1.1"
2022
SUBNET_MASK = "255.255.255.0"
@@ -35,8 +37,8 @@
3537

3638
s_in = socket.socket(type=socket.SOCK_DGRAM)
3739
s_in.settimeout(UDP_TIMEOUT)
38-
print("set hostname:")
39-
esp.set_hostname("new_hostname".encode("utf-8"))
40+
print("set hostname:", HOSTNAME)
41+
esp.set_hostname(HOSTNAME)
4042

4143
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
4244
print("ESP32 found and in idle mode")

0 commit comments

Comments
 (0)