bamlormakmak

Dependencies:   mbed

Committer:
jaybehandsome
Date:
Fri Dec 08 20:40:25 2017 +0000
Revision:
5:587de5c5fc38
Parent:
4:75962425e27b
puck you

Who changed what in which revision?

UserRevisionLine numberNew 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 {
jaybehandsome 2:2f71623970f7 7 char data[8] ;
jaybehandsome 2:2f71623970f7 8 int x = 0;
jaybehandsome 3:47af38e57498 9 char recieve;
jaybehandsome 2:2f71623970f7 10 pc.printf("Hello World\n");
jaybehandsome 5:587de5c5fc38 11 for (x = 0; x<8; x++)
jaybehandsome 5:587de5c5fc38 12 {
jaybehandsome 5:587de5c5fc38 13 data[x] = NULL;
jaybehandsome 5:587de5c5fc38 14 }
jnjtnutty 1:1197e9258bc7 15 // char ch;
jnjtnutty 1:1197e9258bc7 16 // pc.baud(38400);
jnjtnutty 1:1197e9258bc7 17 // bt.baud(38400);
jnjtnutty 1:1197e9258bc7 18 // pc.printf("Hello World!\n\r");
jnjtnutty 1:1197e9258bc7 19 // bt.printf("Hello World!\r\n");
jnjtnutty 1:1197e9258bc7 20 //
jnjtnutty 1:1197e9258bc7 21 // while(1)
jnjtnutty 1:1197e9258bc7 22 // {
jnjtnutty 1:1197e9258bc7 23 // if(bt.readable())
jnjtnutty 1:1197e9258bc7 24 // {
jnjtnutty 1:1197e9258bc7 25 // ch=bt.getc();
jnjtnutty 1:1197e9258bc7 26 // pc.printf("%c",ch);
jnjtnutty 1:1197e9258bc7 27 // }
jnjtnutty 1:1197e9258bc7 28 //
jnjtnutty 1:1197e9258bc7 29 // else if(pc.readable())
jnjtnutty 1:1197e9258bc7 30 // {
jnjtnutty 1:1197e9258bc7 31 // ch=pc.getc();
jnjtnutty 1:1197e9258bc7 32 // bt.printf("%c",ch);
jnjtnutty 1:1197e9258bc7 33 // }
jnjtnutty 1:1197e9258bc7 34 // }
jaybehandsome 0:0216e64ccf1b 35 while(1)
jaybehandsome 0:0216e64ccf1b 36 {
jaybehandsome 0:0216e64ccf1b 37 if(bt.readable())
jaybehandsome 0:0216e64ccf1b 38 {
jaybehandsome 5:587de5c5fc38 39 data[x] = bt.getc();
jaybehandsome 3:47af38e57498 40 if (data[x] == '!')
jaybehandsome 2:2f71623970f7 41 {
jaybehandsome 2:2f71623970f7 42 x = 0;
jaybehandsome 2:2f71623970f7 43 }
jaybehandsome 4:75962425e27b 44 // if (x == 8)
jaybehandsome 4:75962425e27b 45 // {
jaybehandsome 4:75962425e27b 46 // x=0;
jaybehandsome 4:75962425e27b 47 // }
jaybehandsome 4:75962425e27b 48 pc.printf("%c%c%c%c%c%c%c%c",data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
jaybehandsome 2:2f71623970f7 49 x++;
jaybehandsome 2:2f71623970f7 50
jaybehandsome 0:0216e64ccf1b 51 }
jnjtnutty 1:1197e9258bc7 52 if(pc.readable())
jaybehandsome 0:0216e64ccf1b 53 {
jaybehandsome 3:47af38e57498 54 recieve = pc.getc();
jaybehandsome 3:47af38e57498 55 bt.putc(recieve);
jaybehandsome 3:47af38e57498 56
jaybehandsome 0:0216e64ccf1b 57 }
jaybehandsome 0:0216e64ccf1b 58 }
jaybehandsome 0:0216e64ccf1b 59 }