使用 c++ .in Linux 进行串行通信
serial communication using c++ .in Linux
我可以串行发送 1 字节字符类型数据。 现在我被困在发送浮点型数据上。 这是我串行发送数据的代码。
fd = open("/dev/ttyO1", O_RDWR | O_NOCTTY);
char byte_out[] = {0x47};
write(fd, byte_out, strlen(byte_out)+1);
如何串行写入(或发送)浮点类型数据。请帮助我.提前谢谢.
没有什么不同..你需要放置正确的浮点类型大小..
fd = open("/dev/ttyO1", O_RDWR | O_NOCTTY);
float float_out[] = {1.2342};
write(fd, (void *) float_out, sizeof(float));
相关文章:
- 在C++/Linux中设置单调时钟的一些技巧
- Linux的Cpp上的计时器
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 在Linux中哪里可以找到互斥、未来等的源代码
- 如何将 Firebase 与基于 Linux 的客户端应用配合使用,以便与服务器进行双向消息通信
- 网站和C++程序在同一台 Linux PC 上的通信
- 如何检测和与Linux下的另一个过程进行通信
- Linux下的C++串行通信
- C++ Linux 代理服务器通信
- 使用 c++ .in Linux 进行串行通信
- CAN-BUS通信-MSG结构(Winuser.h)Linux等效
- Linux上的低延迟串行通信
- Linux中C++Tcp通信中的间歇性延迟
- 使用 Linux 与 Arduino 通信
- 如何在Linux中与进程通信
- Windows XP到Ubuntu Linux点对点通信使用Python或C/ c++
- 是否有可能通过远程方法调用将linux中的c++程序与作为服务器的c#程序进行通信?
- 在Linux上使用c++进行混合通信
- 串口通信c++ Linux
- 在 Arduino UNO 和运行 Linux 的笔记本电脑之间设置蓝牙 (BLE) 通信