我正在将数据从 Arduino 发送到串口:
byte xBeeFrame[23];
unsigned int windData,
signed int tempData;
xBeeFrame[0] = 0x7E;
xBeeFrame[18] = (windData >> 8) & 0xFF;
xBeeFrame[19] = windData & 0xFF;
xBeeFrame[20] = (tempData >> 8) & 0xFF;
xBeeFrame[21] = tempData & 0xFF;
问题是在 C 程序中解析这些数据。我怎么做猫?这是我读取串行端口的方式:
unsigned char bytes[254];
if (read(tty_fd,bytes,sizeof(bytes))>0){
///write(STDOUT_FILENO,bytes,sizeof(bytes)); // if new data is available on the serial port, print it out
感谢帮助!