1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 11:44:53 +08:00
serial/src/test_serial.cpp

27 lines
587 B
C++
Raw Normal View History

2011-03-16 08:03:54 -05:00
#include <string>
#include <iostream>
#include "serial.h"
Serial *serial;
int main(int argc, char **argv)
{
std::string port("/dev/tty.usbserial-A900cfJA");
// std::string port("/dev/tty.usbmodemfa141");
2011-03-16 08:03:54 -05:00
serial = new Serial(port, 115200, 250);
2011-03-16 08:03:54 -05:00
int count = 0;
while (count >= 0) {
int bytes_wrote = serial->write("Testing.");
std::string result = serial->read(8);
if(count % 10 == 0)
std::cout << ">" << count << ">" << bytes_wrote << ">" << result << std::endl;
count += 1;
2011-03-16 08:03:54 -05:00
}
return 0;
2011-03-18 19:02:32 -05:00
}