2andnot

main_com_port

Sep 15th, 2020 (edited)
690
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<Windows.h>
  3. #include <cstring>
  4. #include "SerialPort.h"
  5.  
  6. using namespace std;
  7. HANDLE Port;
  8. int main(int arg, CHAR* argc[]) {
  9.     Port = initSerial(8, 1200, 8, byteStop1, 0);
  10.     sendData(Port, "hello world", sizeof("hello world"));
  11.     char message[1024];
  12.     cout << "len = " << getData(Port, message, sizeof("hello world")) << endl;
  13.     cout << message << endl;
  14.     return 0;
  15. }
RAW Paste Data