bamlormakmak
Dependencies: mbed
main.cpp@1:1197e9258bc7, 2017-12-08 (annotated)
- Committer:
- jnjtnutty
- Date:
- Fri Dec 08 19:26:38 2017 +0000
- Revision:
- 1:1197e9258bc7
- Parent:
- 0:0216e64ccf1b
- Child:
- 2:2f71623970f7
nutty
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); |
jnjtnutty | 1:1197e9258bc7 | 4 | int bye; |
jaybehandsome | 0:0216e64ccf1b | 5 | int main(void) |
jaybehandsome | 0:0216e64ccf1b | 6 | { |
jnjtnutty | 1:1197e9258bc7 | 7 | char *data[8] ; |
jnjtnutty | 1:1197e9258bc7 | 8 | |
jnjtnutty | 1:1197e9258bc7 | 9 | // char ch; |
jnjtnutty | 1:1197e9258bc7 | 10 | // pc.baud(38400); |
jnjtnutty | 1:1197e9258bc7 | 11 | // bt.baud(38400); |
jnjtnutty | 1:1197e9258bc7 | 12 | // pc.printf("Hello World!\n\r"); |
jnjtnutty | 1:1197e9258bc7 | 13 | // bt.printf("Hello World!\r\n"); |
jnjtnutty | 1:1197e9258bc7 | 14 | // |
jnjtnutty | 1:1197e9258bc7 | 15 | // while(1) |
jnjtnutty | 1:1197e9258bc7 | 16 | // { |
jnjtnutty | 1:1197e9258bc7 | 17 | // if(bt.readable()) |
jnjtnutty | 1:1197e9258bc7 | 18 | // { |
jnjtnutty | 1:1197e9258bc7 | 19 | // ch=bt.getc(); |
jnjtnutty | 1:1197e9258bc7 | 20 | // pc.printf("%c",ch); |
jnjtnutty | 1:1197e9258bc7 | 21 | // } |
jnjtnutty | 1:1197e9258bc7 | 22 | // |
jnjtnutty | 1:1197e9258bc7 | 23 | // else if(pc.readable()) |
jnjtnutty | 1:1197e9258bc7 | 24 | // { |
jnjtnutty | 1:1197e9258bc7 | 25 | // ch=pc.getc(); |
jnjtnutty | 1:1197e9258bc7 | 26 | // bt.printf("%c",ch); |
jnjtnutty | 1:1197e9258bc7 | 27 | // } |
jnjtnutty | 1:1197e9258bc7 | 28 | // } |
jaybehandsome | 0:0216e64ccf1b | 29 | while(1) |
jaybehandsome | 0:0216e64ccf1b | 30 | { |
jaybehandsome | 0:0216e64ccf1b | 31 | if(bt.readable()) |
jaybehandsome | 0:0216e64ccf1b | 32 | { |
jnjtnutty | 1:1197e9258bc7 | 33 | bt.scanf("%s", data); |
jnjtnutty | 1:1197e9258bc7 | 34 | pc.printf("%s\r\n", data); |
jnjtnutty | 1:1197e9258bc7 | 35 | //pc.scanf("%s", &data); |
jnjtnutty | 1:1197e9258bc7 | 36 | //pc.printf(data); |
jaybehandsome | 0:0216e64ccf1b | 37 | } |
jnjtnutty | 1:1197e9258bc7 | 38 | if(pc.readable()) |
jaybehandsome | 0:0216e64ccf1b | 39 | { |
jnjtnutty | 1:1197e9258bc7 | 40 | pc.scanf("%s", data); |
jnjtnutty | 1:1197e9258bc7 | 41 | bt.printf("%s\r\n", data); |
jaybehandsome | 0:0216e64ccf1b | 42 | } |
jaybehandsome | 0:0216e64ccf1b | 43 | } |
jaybehandsome | 0:0216e64ccf1b | 44 | } |