Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 3:ec621d656d40
- Parent:
- 2:38b75c9771fc
- Child:
- 4:51abc140d5d2
diff -r 38b75c9771fc -r ec621d656d40 main.cpp
--- a/main.cpp Tue Apr 28 16:21:36 2015 +0000
+++ b/main.cpp Thu Apr 30 23:53:19 2015 +0000
@@ -19,19 +19,18 @@
Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut bt_pair(PA_7);
-DigitalOut bt_reset(PA_9);
-DigitalOut rts(PA_8);
-DigitalIn cts(PB_10);
+DigitalOut bt_reset(PC_);
+
Timer timeout;
char responseBuff[4];
char responseOk[4] = {'\r','\n','K','O'};
-bool BC127_confirm = false;
bool bluetooth_command(string command){
bluetooth.printf("%s\r",command);
+ pc.printf("SENDING {%s}\r",command);
timeout.reset();
timeout.start();
- while(timeout.read_ms()<500){
+ while(timeout.read_ms()<1000){
if(memcmp(&responseOk[0],&responseBuff[0],4) == 0){
pc.printf("%d ms\r",timeout.read_ms());
timeout.stop();
@@ -66,28 +65,6 @@
wait(0.5);
bluetooth.baud(9600);
wait(.1);
- /*bluetooth.printf("SET NAME=ARC502RB\r");
- wait(1.2);
- bluetooth.printf("SET NAME_SHORT=ARC5\r");
- wait(1.2);
- //bluetooth.printf("SET FLOW_CTRL=ON\r");
- //wait(1.2);
- bluetooth.printf("SET BLE_ROLE=1\r");
- wait(1.2);
- bluetooth.printf("SET ADVERTISING=ON\r");
- wait(1.2);
- bluetooth.printf("WRITE\r");
- wait(1.2);
- bluetooth.printf("RESET\r");
- wait(1);*/
- //bluetooth.set_flow_control(Serial::RTSCTS,rts,cts);
- //wait(.5);
- //bluetooth.printf("SET BAUD=115200\r");
- //wait(0.5);
- //bluetooth.baud(115200);
- //wait(0.1);
- //bluetooth.printf("ENTER_DATA\r");
- //wait(2);
}
void readResponse(){
for(int z=2;z>0;z--){
@@ -115,7 +92,6 @@
debug&=bluetooth_command("SET NAME=BC127 BLE");
debug&=bluetooth_command("SET NAME_SHORT=BCBLE");
debug&=bluetooth_command("SET ENABLE_SPP=ON");
-
debug&=bluetooth_command("SET ENABLE_IAP=OFF");
debug&=bluetooth_command("SET ENABLE_IAP_V2=OFF");
debug&=bluetooth_command("SET ENABLE_MAP=OFF");