mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
Read has been informally tested to work.
This commit is contained in:
parent
465d32cb8c
commit
fc4364f7b4
@ -27,15 +27,16 @@ int main(int argc, char **argv)
|
|||||||
std::string port("/dev/tty.usbserial-A900cfJA");
|
std::string port("/dev/tty.usbserial-A900cfJA");
|
||||||
// std::string port("/dev/tty.usbmodemfa141");
|
// std::string port("/dev/tty.usbmodemfa141");
|
||||||
|
|
||||||
serial = new Serial(port, 9600, 250);
|
serial = new Serial(port, 115200, 250);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (count != 30) {
|
while (count >= 0) {
|
||||||
// serial->write("Testing.");
|
int bytes_wrote = serial->write("Testing.");
|
||||||
std::string result = serial->read(1);
|
std::string result = serial->read(8);
|
||||||
std::cout << ">" << result << std::endl;
|
if(count % 10 == 0)
|
||||||
|
std::cout << ">" << count << ">" << bytes_wrote << ">" << result << std::endl;
|
||||||
|
|
||||||
// count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user