Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

wax100628/serialportlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple Lib for Serial Port on Windows

Usage:

#include "serialport.h"
#include <iostream>

#pragma comment(lib, "serialport.lib")

using namespace LuHang;

/* When data is comming, Lib calls this function */
void Callback(const char* data, int len)
{
	// to-do with recved data
}

int main()
{

	SerialPort sp(&Callback);
	
	bool ret = sp.open("COM1");

	// sp.setBaudRate(115200);
	// sp.setBitsNum(8);
	// sp.setParity(Parity::NO);
	// sp.setStopBits(StopBits::ONEBIT);
	// sp.setFlowControl(FlowControl::NONE);
	// ...
	// sp.write(buf, len);
	
	std::cin.get();

	return 0;
}

About

a serialport class for Windows C++ proj

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages