diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-04-08 13:36:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-08 13:36:34 -0400 |
commit | c3946e1a73aec0eb75ff4301dc42e1a2a71aab60 (patch) | |
tree | 9bfd6b6df4666491295b30088a6bf7bec6f61757 /include/serial/SerialPort.hpp | |
parent | 0fd63dfa5dfcac42a45f0b247e8461b4b969d6f7 (diff) | |
parent | 3180cb7584c037463ee5c2047aea3e3ed0f0b364 (diff) |
Diffstat (limited to 'include/serial/SerialPort.hpp')
-rw-r--r-- | include/serial/SerialPort.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/serial/SerialPort.hpp b/include/serial/SerialPort.hpp new file mode 100644 index 0000000..a207d0c --- /dev/null +++ b/include/serial/SerialPort.hpp @@ -0,0 +1,31 @@ +/*
+* Author: Manash Kumar Mandal
+* Modified Library introduced in Arduino Playground which does not work
+* This works perfectly
+* LICENSE: MIT
+*/
+
+#pragma once
+
+#define ARDUINO_WAIT_TIME 2000
+#define MAX_DATA_LENGTH 255
+
+#include <windows.h>
+#include <iostream>
+
+class SerialPort
+{
+private:
+ HANDLE handler;
+ bool connected;
+ COMSTAT status;
+ DWORD errors;
+public:
+ explicit SerialPort(const char *portName, int BAUD);
+ ~SerialPort();
+
+ int readSerialPort(const char *buffer, unsigned int buf_size);
+ bool writeSerialPort(const char *buffer, unsigned int buf_size);
+ bool isConnected();
+ void closeSerial();
+};
\ No newline at end of file |