在openmv中使用mqtt经常会在通信过程中报OSError:-6或者OSError:-12的错误是为什么呢?
-
大致内容如下
forkliftid = 'A01' containerid = '00000001' def pub_push_position(forkliftid,containerid='',x='',y='',theta=''): tempPic = sensor.snapshot().save("position.jpg", quality=35) imagePath = '.\\position.jpg' with open(imagePath, 'rb') as p: tempPic = p.read() base64pic = ubinascii.b2a_base64(tempPic) pic = str(base64pic, 'utf-8').strip() msg = 'B@POSITION,{0},{1},{2},{3},{4},{5}'.format(forkliftid,containerid,x,y,theta,pic) client.publish('/v1/device/push', msg) SSID='myInternet' # 无线网络名称 KEY='12345677' # 无线网络密码 wlan = network.WINC() wlan.connect(SSID, key=KEY, security=wlan.WPA_PSK) client = MQTTClient("test", '192.168.99.250', port=1883) client.connect() while True: p_in = pyb.Pin('P9', pyb.Pin.IN, pyb.Pin.PULL_UP) if p_in.value() == 0: pub_push_position(forkliftid,containerid,x,y,theta) # x,y,theta是apriltags的x,y和z_rotation client.check_msg()