Hotboards MX
/
Bridge
SERIAL BRIDGE
main.cpp@0:0669f963d466, 2016-06-15 (annotated)
- Committer:
- Hotboards
- Date:
- Wed Jun 15 18:47:42 2016 +0000
- Revision:
- 0:0669f963d466
FIRS RELEASE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Hotboards | 0:0669f963d466 | 1 | |
Hotboards | 0:0669f963d466 | 2 | #include "mbed.h" |
Hotboards | 0:0669f963d466 | 3 | Serial device(PC_10,PC_11); |
Hotboards | 0:0669f963d466 | 4 | Serial pc(USBTX,USBRX); |
Hotboards | 0:0669f963d466 | 5 | |
Hotboards | 0:0669f963d466 | 6 | int main() |
Hotboards | 0:0669f963d466 | 7 | { |
Hotboards | 0:0669f963d466 | 8 | device.baud(9600); |
Hotboards | 0:0669f963d466 | 9 | pc.baud(9600); |
Hotboards | 0:0669f963d466 | 10 | |
Hotboards | 0:0669f963d466 | 11 | while(1) |
Hotboards | 0:0669f963d466 | 12 | { |
Hotboards | 0:0669f963d466 | 13 | |
Hotboards | 0:0669f963d466 | 14 | if(device.readable()) |
Hotboards | 0:0669f963d466 | 15 | { |
Hotboards | 0:0669f963d466 | 16 | pc.putc(device.getc()); |
Hotboards | 0:0669f963d466 | 17 | } |
Hotboards | 0:0669f963d466 | 18 | |
Hotboards | 0:0669f963d466 | 19 | if(pc.readable()) |
Hotboards | 0:0669f963d466 | 20 | { |
Hotboards | 0:0669f963d466 | 21 | device.putc(pc.getc()); |
Hotboards | 0:0669f963d466 | 22 | } |
Hotboards | 0:0669f963d466 | 23 | |
Hotboards | 0:0669f963d466 | 24 | } |
Hotboards | 0:0669f963d466 | 25 | } |