#include "uart.h" int main(int argc, char *argv[]) { unsigned char w_buf[10] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; //通过串口发送出去的数据 if (uart_Init()) exit(EXIT_FAILURE); for (int i = 0; i < 100; i++) { write(fd, w_buf, 8); //一次向串口写入 8 个字节 sleep(1); //间隔 1 秒钟 } }