You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
684 B

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "serial.h"
#include "steering_gear.h"
PORT serial_port;
int serial_com_id;
int main(int argc, char *argv[]) {
/* 参数判断 */
if (argc != 2) {
printf("please input com id\n");
return -1;
}
printf("Serial port number is:%s\n", argv[1]);
/* 字符串转int类型 */
serial_com_id = atoi(argv[1]);
if (serial_com_id == 0) { /* */
/* 转换错误 */
printf("The serial port id is incorrect\n");
return -2;
}
serial_port = serial_init(serial_com_id, 115200, 8, 1, 0);
while (1) {
Serial_SendData(serial_port, "hello finny", 12);
Sleep(1000);
}
return 0;
}