You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
671 B
Plaintext
30 lines
671 B
Plaintext
# MindPlus
|
|
# maixduino
|
|
from network_esp32 import wifi
|
|
from umqtt import MQTTClient
|
|
import time
|
|
import lcd
|
|
|
|
|
|
lcd.init(freq=15000000, color=65287, invert=0)
|
|
print(wifi.scan())
|
|
while not (wifi.isconnected()):
|
|
time.sleep_ms(int(200))
|
|
wifi.connect("GDKM_teacher", "")
|
|
print("连接到热点")
|
|
time.sleep(1)
|
|
print(wifi.ifconfig()[0])
|
|
print(wifi.ping("10.21.18.204"))
|
|
time.sleep(1)
|
|
mqtt = MQTTClient("A01","10.21.18.204",1883,"","",60)
|
|
print("初始化MQTT")
|
|
try:
|
|
mqtt.connect()
|
|
print('MQTT Connected Successful')
|
|
except:
|
|
print('MQTT Connection Failed')
|
|
print("连接MQTT")
|
|
time.sleep(1)
|
|
mqtt.publish(str("407/01"), str("冯文涛").encode('utf-8'))
|
|
print("发布")
|