Skip to content

Commit f96c1da

Browse files
committed
adjust mqtt
1 parent e1fec18 commit f96c1da

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

12.network/server_mqtt.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import wifi
22
wifi.start()
33

4-
server_ip = "192.168.30.105"
4+
server_ip = "192.168.123.97"
55
client_id = "umqtt_client"
66

77
import time
@@ -20,13 +20,16 @@ def sub_cb(topic, msg):
2020
c.set_callback(sub_cb)
2121

2222
if not c.connect(clean_session = False):
23-
c.subscribe(b"foo_topic")
23+
c.subscribe(b"foo_topic")
24+
25+
c.publish(b"foo_topic", b"hello")
2426

2527
while 1:
2628
time.sleep(1)
2729
if c.check_msg() is not None:
2830
c.wait_msg()
2931
else:
3032
print('other operator')
33+
3134
finally:
3235
c.disconnect()

0 commit comments

Comments
 (0)