root / trunk / code / projects / colonet / testing / robot_dongle_test / robot_dongle_test.cpp @ 13
History | View | Annotate | Download (382 Bytes)
1 | 13 | emarinel | /**
|
---|---|---|---|
2 | * Eugene Marinelli
|
||
3 | * 1/31/07
|
||
4 | *
|
||
5 | * robot_dongle_test - trying to figure out how to get bytes from the robot.
|
||
6 | */
|
||
7 | |||
8 | #include <unistd.h> |
||
9 | #include <stdio.h> |
||
10 | #include <fcntl.h> |
||
11 | |||
12 | int main()
|
||
13 | { |
||
14 | int fd = open("/dev/ttyS0", O_RDWR); |
||
15 | char buf[80]; |
||
16 | |||
17 | while(1){ |
||
18 | //write(fd, "0", 1);
|
||
19 | if(read(fd, buf, 1)){ |
||
20 | printf("%c\n", buf[0]); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | close(fd); |
||
25 | |||
26 | return 0; |
||
27 | } |