robot 的 串口操作
1、关闭串口 如果没有创建串口,关闭串口就会报错 SerialLibrary.Close Port SerialLibrary.Delete All Ports Run Keyword And Ignore Error 可以用该命令来忽略错误 2、添加串口 SerialLibrary.Add Port ${port} baudrate=${baudrate} #baudrate, bytesize, parity, stopbits,timeout, xonxoff, rtscts, write_timeout, dsrdtr and inter_byte_timeout. write_timeout=120.1 3、打开串口,获取串口返回的字符编码 SerialLibrary.Open Port ${port} ${a} SerialLibrary.Get Encoding log ${a} 4、往串口写如数据,注明输入字符的编码 SerialLibrary.Write Data \n UTF-8 5、刷新端口 SerialLibrary.Flush Port sleep 1 Flush port so that all waiting data is processed. 刷新端口,以便处理所有等待的数据。 6、读取串口输出数据 SerialLibrary.Read All