bamlormakmak
Dependencies: mbed
main.cpp
- Committer:
- jaybehandsome
- Date:
- 2017-12-08
- Revision:
- 4:75962425e27b
- Parent:
- 3:47af38e57498
- Child:
- 5:587de5c5fc38
File content as of revision 4:75962425e27b:
#include "mbed.h" Serial pc(USBTX, USBRX); Serial bt(PA_15, PB_7); int bye; int main(void) { char data[8] ; int x = 0; char recieve; pc.printf("Hello World\n"); // char ch; // pc.baud(38400); // bt.baud(38400); // pc.printf("Hello World!\n\r"); // bt.printf("Hello World!\r\n"); // // while(1) // { // if(bt.readable()) // { // ch=bt.getc(); // pc.printf("%c",ch); // } // // else if(pc.readable()) // { // ch=pc.getc(); // bt.printf("%c",ch); // } // } while(1) { if(bt.readable()) { data[x] = pc.getc(); if (data[x] == '!') { x = 0; } // if (x == 8) // { // x=0; // } 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]); x++; } if(pc.readable()) { recieve = pc.getc(); bt.putc(recieve); } } }