Debug code for implementing BLE on BC127

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Dot
Date:
Fri May 01 16:29:33 2015 +0000
Parent:
4:51abc140d5d2
Commit message:
Moved log function as to not interfere with commands.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri May 01 16:13:20 2015 +0000
+++ b/main.cpp	Fri May 01 16:29:33 2015 +0000
@@ -1,17 +1,5 @@
 #include "mbed.h"
 #include<string>
-/*
-Consider adding:
-
-DEV_INFO =
-ACCESSORY_NAME=Arc Chest Strap
-MANUFACTURER_NAME=Aegle
-MODEL_NAME=Arc CS1
-SERIAL_NO=0000000000
-HARDWARE_VER=0 5 2 
-FIRMWARE_VER=0 5 2
-*/
-
 //LED
 PwmOut stm_led(LED1);
 //Bluetooth
@@ -26,8 +14,8 @@
 char responseOk[4] = {'\r','\n','K','O'};
 
 bool bluetooth_command(string command){
+    pc.printf("SENDING {%s}\r",command);
     bluetooth.printf("%s\r",command);
-    pc.printf("SENDING {%s}\r",command);
     timeout.reset();
     timeout.start();
     while(timeout.read_ms()<2000){
@@ -63,6 +51,8 @@
     wait(0.5);
     bt_pair =0;
     wait(0.5);
+    bluetooth.baud(9600);
+    wait(.1);
 }
 void readResponse(){
     for(int z=2;z>0;z--){
@@ -86,10 +76,7 @@
     stm_led=1;
     wait(1);
     pc.printf("Atempting to send command\r");
-    
-    bluetooth.printf("$$$$\r");
     wait(1);
-    
     bluetooth_command("RESTORE");
     debug&=bluetooth_command("SET NAME=BC127 BLE");
     debug&=bluetooth_command("SET NAME_SHORT=BCBLE");
@@ -108,8 +95,6 @@
         if(debug==true){
         stm_led=!stm_led;
         wait(2);
-        //bluetooth.printf("SEND BLE HelloWorld\r");
-        //Results in "ERROR" from BC127
         }
     }
 }
\ No newline at end of file