Robert Spilleboudt
/
BT01
A simple BT communication between PC and HT-06
Revision 0:cf3a3ae84ff4, committed 2016-04-18
- Comitter:
- robertspil
- Date:
- Mon Apr 18 10:25:38 2016 +0000
- Commit message:
- simple test program bluetoth-pc
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r cf3a3ae84ff4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 18 10:25:38 2016 +0000 @@ -0,0 +1,48 @@ +/* BT01 Test Bluetooth serial communication + mbed1768 sur breadboard, alimenté par cable USB + serial debug par USB et console Gtkterm + device HC-06 + GND + VCC = VU du mbed (5V) + RX =P28 (tx du mbed) + TX =P27 (rx du mbed) +au préalable : utiliser BlueTerm pour se connecter et pairage (code 1234) id 20:15:1224:10:03 +ensuite utiliser ce programme pour +*/ +#include "mbed.h" +Serial pc(USBTX, USBRX); +Serial bt (p28,p27); +DigitalOut myled(LED1); + +int main() { + // communication avec Gtkterm - prévoir local echo + pc.baud(115200); + pc.printf("Start bt communication\n"); + //bt.baud(9600); // HC-06 org speed + bt.baud(115200); // my standart speed BAUD8 + // AT commands WITHOUT CONNECTION (blinking led HC-06) + // rove the /* ...*/ to activate + /*wait(1); + bt.printf("AT"); + wait(1);*/ + /*bt.printf("AT+VERSION"); + wait(1); + while(bt.readable()) { + pc.putc(bt.getc()); + } + wait(1); + */ + /*bt.printf("AT+NAMEHC_06_RcclV5b"); + wait(1); */ + /*bt.printf("AT+BAUD8"); // 115200 bauds + wait(1); + bt.baud(115200);*/ + + while(1){ //duplex + while(pc.readable()) + bt.putc(pc.getc()); + while(bt.readable()) + pc.putc(bt.getc()); + } + + }
diff -r 000000000000 -r cf3a3ae84ff4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 18 10:25:38 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5 \ No newline at end of file