bamlormakmak
Dependencies: mbed
main.cpp@0:0216e64ccf1b, 2017-12-08 (annotated)
- Committer:
- jaybehandsome
- Date:
- Fri Dec 08 14:03:08 2017 +0000
- Revision:
- 0:0216e64ccf1b
- Child:
- 1:1197e9258bc7
full at mode hc05
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jaybehandsome | 0:0216e64ccf1b | 1 | #include "mbed.h" |
jaybehandsome | 0:0216e64ccf1b | 2 | Serial pc(USBTX, USBRX); |
jaybehandsome | 0:0216e64ccf1b | 3 | Serial bt(PA_15, PB_7); |
jaybehandsome | 0:0216e64ccf1b | 4 | int main(void) |
jaybehandsome | 0:0216e64ccf1b | 5 | { |
jaybehandsome | 0:0216e64ccf1b | 6 | char ch; |
jaybehandsome | 0:0216e64ccf1b | 7 | pc.baud(38400); |
jaybehandsome | 0:0216e64ccf1b | 8 | bt.baud(38400); |
jaybehandsome | 0:0216e64ccf1b | 9 | pc.printf("Hello World!\n\r"); |
jaybehandsome | 0:0216e64ccf1b | 10 | bt.printf("Hello World!\r\n"); |
jaybehandsome | 0:0216e64ccf1b | 11 | |
jaybehandsome | 0:0216e64ccf1b | 12 | while(1) |
jaybehandsome | 0:0216e64ccf1b | 13 | { |
jaybehandsome | 0:0216e64ccf1b | 14 | if(bt.readable()) |
jaybehandsome | 0:0216e64ccf1b | 15 | { |
jaybehandsome | 0:0216e64ccf1b | 16 | ch=bt.getc(); |
jaybehandsome | 0:0216e64ccf1b | 17 | pc.printf("%c",ch); |
jaybehandsome | 0:0216e64ccf1b | 18 | } |
jaybehandsome | 0:0216e64ccf1b | 19 | |
jaybehandsome | 0:0216e64ccf1b | 20 | else if(pc.readable()) |
jaybehandsome | 0:0216e64ccf1b | 21 | { |
jaybehandsome | 0:0216e64ccf1b | 22 | ch=pc.getc(); |
jaybehandsome | 0:0216e64ccf1b | 23 | bt.printf("%c",ch); |
jaybehandsome | 0:0216e64ccf1b | 24 | } |
jaybehandsome | 0:0216e64ccf1b | 25 | } |
jaybehandsome | 0:0216e64ccf1b | 26 | } |