def onRead():
if not serial.canReadLine(): return # выходим если нечего читать
rx = serial.readLine()
rxs = str(rx, 'utf-8').strip()
data = rxs.split(',')
if data[0] == '0':
ui.lcdN.display(data[1])
ui.tempB.setValue(int(float(data[3]) * 10))
ui.tempL.setText(data[3])
global listX
global listY
listY = listY[1:]
listY.append(int(data[2]))
ui.graph.clear()
ui.graph.plot(listX, listY)
if data[0] == '1':
if data[1] == '0':
ui.circle.setChecked(True)
else:
ui.circle.setChecked(False)
if data[0] == '2':
global posX
global posY
posX += int((int(data[1]) - 512) / 100)
posY += int((int(data[2]) - 512) / 100)
ui.circle.setGeometry(posX, posY, 20, 20)
def onOpen():
serial.setPortName(ui.comL.currentText())
serial.open(QIODevice.ReadWrite)