Skip to content

SerialCPP is a cross-platform C++ library for serial communication, for use on both Windows and Unix-like systems (such as Linux or macOS).

License

Notifications You must be signed in to change notification settings

joeinman/SerialCPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SerialCPP

CMake

SerialCPP is a cross-platform C++ library for serial communication. Based on PySerial and Arduino Serial, it provides a simple and consistent API for use on both Windows and Unix-like systems (such as Linux or macOS).

Features:

  • Open & Close Serial Ports
  • Read and Write Data to Serial Ports
  • Read & Write a Line of Text to and From a Serial Port

Basic Example:

#include <SerialCPP/SerialCPP.h>
#include <iostream>
#include <string>

int main()
{
    // Create A SerialCPP Object Using The COM3 Port With A 115200 Baud Rate
    SerialCPP::SerialCPP serial("COM3", SerialCPP::BaudRate::BR_115200);

    // Open The Serial Port
    if (!serial.open())
    {
        std::cerr << "Failed To Open Serial Port.\n";
        return 1;
    }

    // Write A Line Of Text To The Serial Port
    serial.writeLine("Hello World.");

    // Read A Line Of Text From The Serial Port
    std::string line = serial.readLine();
    std::cout << "Received: " << line << '\n';

    // Close The Serial Port
    serial.close();
    return 0;
}

About

SerialCPP is a cross-platform C++ library for serial communication, for use on both Windows and Unix-like systems (such as Linux or macOS).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published