Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:da5e19098ee6, 2015-10-24 (annotated)
- Committer:
- Teck
- Date:
- Sat Oct 24 21:41:25 2015 +0000
- Revision:
- 0:da5e19098ee6
serial passthrough
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Teck | 0:da5e19098ee6 | 1 | #include "mbed.h" |
Teck | 0:da5e19098ee6 | 2 | |
Teck | 0:da5e19098ee6 | 3 | //------------------------------------ |
Teck | 0:da5e19098ee6 | 4 | // Hyperterminal configuration |
Teck | 0:da5e19098ee6 | 5 | // 9600 bauds, 8-bit data, no parity |
Teck | 0:da5e19098ee6 | 6 | //------------------------------------ |
Teck | 0:da5e19098ee6 | 7 | |
Teck | 0:da5e19098ee6 | 8 | Serial pc(USBTX, USBRX); // tx, rx |
Teck | 0:da5e19098ee6 | 9 | Serial device(PA_9, PA_10); // tx, rx |
Teck | 0:da5e19098ee6 | 10 | //Serial device(PA_2, PA_3); // tx, rx |
Teck | 0:da5e19098ee6 | 11 | |
Teck | 0:da5e19098ee6 | 12 | int main() { |
Teck | 0:da5e19098ee6 | 13 | while(1) { |
Teck | 0:da5e19098ee6 | 14 | if(pc.readable()) { |
Teck | 0:da5e19098ee6 | 15 | device.putc(pc.getc()); |
Teck | 0:da5e19098ee6 | 16 | } |
Teck | 0:da5e19098ee6 | 17 | if(device.readable()) { |
Teck | 0:da5e19098ee6 | 18 | pc.putc(device.getc() + 5); |
Teck | 0:da5e19098ee6 | 19 | } |
Teck | 0:da5e19098ee6 | 20 | } |
Teck | 0:da5e19098ee6 | 21 | } |