⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sync_com1.cpp

📁 串口演示源程序合集
💻 CPP
字号:

#include <iostream>
#include <exception>
using namespace std;

#include <windows.h>
#include "com_class.h"

int main(int argc, char *argv[])
{
	try
	{
		char str[] = "com_class test";
		_sync_com com1;	//同步
		com1.open(1); // 相当于 com1.open(1, 9600);  com1.open(1, "9600,8,n,1");
		for(int i=0; i<100; i++)
		{
			Sleep(500);
			com1.write(str); //也可以 com1.write(str, strlen(str));
		}
		com1.close();
	}
	catch(exception &e)
	{
		cout << e.what() << endl;
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -