Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "serialib.h"
- #include "iostream"
- #include "string"
- int _tmain(int argc, _TCHAR* argv[])
- {
- std::string port;
- std::string address;
- printf("Heartbeat Address: ");
- std::cin >> address;
- printf("COM Port: ");
- std::cin >> port;
- serialib Serial;
- if(Serial.Open(port.c_str(), 9600) != 1) {
- printf("Serial communication established on COM%s\nSending ICMP heartbeat request to server on %s", port, address);
- while(true) {
- Serial.WriteChar('1');
- Sleep(1000);
- }
- }else {
- printf("Could not establish serial communication with hearbeat box on COM%s, exiting...", port);
- Sleep(2000);
- exit(EXIT_FAILURE);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement