text: '''
  # file sub.py
  
  # brief         Set 'SERVER','CLIENT_ID'(this can be null),'IOT_pubTopic','IOT_UserName','IOT_PassWord'
  #               download into mpython and run the file
  #               You receive the message from server
  # Copyright     Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
  # licence       The MIT License (MIT)
  # author        [LuoYufeng](yufeng.luo@dfrobot.com)
  # version       V1.0
  # date          2019-10-8
  '''
  
  import siot
  import time
  
  SERVER = "192.168.9.107"        #MQTT服务器IP
  CLIENT_ID = ""                  #在SIoT上，CLIENT_ID可以留空
  IOT_pubTopic  = 'xzr/001'       #“topic”为“项目名称/设备名称”
  IOT_UserName ='siot'            #用户名
  IOT_PassWord ='dfrobot'         #密码
  
  def WIFIconnect():
    import network
    ssid = "dfrobotYanfa"
    password =  "hidfrobot"
    station = network.WLAN(network.STA_IF)
    if station.isconnected() == True:
      print("Wifi already connected")
      return
    station.active(True)
    station.connect(ssid, password)
    while station.isconnected() == False:
        pass
    print("Connection successful")
    print(station.ifconfig())
  
  def sub_cb(topic, msg):#pc
      print((topic, msg))
  
  siot.init(CLIENT_ID, SERVER, user=IOT_UserName, password=IOT_PassWord)
  WIFIconnect()
  siot.connect()
  siot.subscribe(IOT_pubTopic, sub_cb)
  siot.loop()
  
  
  try:
    while True:
      pass
  except:
    siot.stop()
    print("disconnect seccused")
  