1 |
// serial1.cpp : Defines the entry point for the console application. |
// serial1.cpp : Defines the entry point for the console application. |
2 |
// |
// |
3 |
|
|
4 |
#ifdef _WINDOWS |
#ifdef _MSC_VER |
|
#include "stdafx.h" |
|
|
|
|
5 |
#include "serial1.h" |
#include "serial1.h" |
6 |
#endif |
#endif |
7 |
|
|
8 |
|
#include "stdafx.h" |
9 |
|
|
10 |
|
|
11 |
#ifdef _DEBUG |
#ifdef _DEBUG |
12 |
#define new DEBUG_NEW |
#define new DEBUG_NEW |
28 |
|
|
29 |
} |
} |
30 |
|
|
31 |
int main() |
int main(int argc, char* argv[]) |
32 |
{ |
{ |
33 |
int count = 0; |
int count = 0; |
34 |
unsigned char c,input; |
unsigned char c,input; |
35 |
CH7Serial serial; |
CH7Serial serial; |
36 |
|
|
37 |
|
if (argc != 2) |
38 |
|
{ |
39 |
|
std::cout << "Usage: " << argv[0] << "<serial port>" << std::endl; |
40 |
|
exit(0); |
41 |
|
} |
42 |
|
|
43 |
try |
try |
44 |
{ |
{ |
45 |
serial.open("/dev/ttyUSB0", 9600); |
|
46 |
|
serial.open(argv[1], 9600); |
47 |
// tænd lysdiode S3 / RB1 |
// tænd lysdiode S3 / RB1 |
48 |
std::cout << "--------------------------------------" << std::endl; |
std::cout << "--------------------------------------" << std::endl; |
49 |
serial.writeTarget(1,1); |
serial.writeTarget(1,1); |