Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Created May 21, 2016 20:36
Show Gist options
  • Save manashmandal/bcff2c0c4aaf9a12251841bde300ea82 to your computer and use it in GitHub Desktop.
Save manashmandal/bcff2c0c4aaf9a12251841bde300ea82 to your computer and use it in GitHub Desktop.
#ifndef SERIALPORT_H
#define SERIALPORT_H
#define ARDUINO_WAIT_TIME 2000
#define MAX_DATA_LENGTH 255
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
class SerialPort
{
private:
HANDLE handler;
bool connected;
COMSTAT status;
DWORD errors;
public:
SerialPort(char *portName);
~SerialPort();
int readSerialPort(char *buffer, unsigned int buf_size);
bool writeSerialPort(char *buffer, unsigned int buf_size);
bool isConnected();
};
#endif // SERIALPORT_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment