dff0a10c
Peter M. Groen
Implementation of...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "SerialPort.hpp"
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char** argv)
{
SerialPort oPort;
oPort.SetDevice( "/dev/ttyUSB0" );
oPort.SetNumDataBits(NumDataBits::EIGHT);
oPort.SetParity(Parity::NONE);
oPort.SetNumStopBits(NumStopBits::ONE);
oPort.SetBaudRate( BaudRate::B_2400 );
oPort.Open();
// Create data package.
std::vector<uint8_t> data_binair;
std::string data_string;
for( uint8_t nCount = 0; nCount < 255; nCount++ )
{
data_binair.push_back( nCount );
data_string += std::to_string(nCount);
}
while( 1 )
{
oPort.WriteBinary( data_binair );
oPort.Write( data_string );
}
return 0;
}
|