wireless debugging via Bluetooth Bee module wiki: http://mbed.org/cookbook/Wireless-Debugging-with-Bluetooth-Bee

Files at this revision

API Documentation at this revision

Comitter:
jyam
Date:
Sat Mar 31 04:12:05 2012 +0000
Parent:
3:d5f6ef5107b4
Commit message:

Changed in this revision

BluetoothBee.cpp Show annotated file Show diff for this revision Revisions of this file
BluetoothBee.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluetoothBee.cpp	Sat Mar 31 04:12:05 2012 +0000
@@ -0,0 +1,21 @@
+//BluetoothBee.cpp
+
+#include"BluetoothBee.h"
+#include "mbed.h"
+
+#define WAIT_TIME  2                        // wait time; you may need to increase this number for higher reliability (but slower) 
+
+BluetoothBee::BluetoothBee(PinName tx, PinName rx) :Serial(tx,rx) {}
+
+void BluetoothBee::setup() {
+    baud(38400);                            // the Bluetooth Bee defaults to 38400 baud, 8N1 (8 data bits, no parity, 1 stop bit)
+                                            // mbed defaults to 9600 8N1; thus, change baud rate to 38400
+    printf("\r\n+STWMOD=0\r\n");            // set as slave mode
+    wait(WAIT_TIME);
+    printf("\r\n+STNA=BluetoothBee\r\n");   // set device name as "BluetoothBee"
+    wait(WAIT_TIME);
+    printf("\r\n+STOAUT=1\r\n");            // allow devices to connect to module
+    wait(WAIT_TIME);
+    printf("\r\n+INQ=1\r\n");               // start broadcasting (make device visible)
+    wait(WAIT_TIME);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluetoothBee.h	Sat Mar 31 04:12:05 2012 +0000
@@ -0,0 +1,19 @@
+// BluetoothBee.h
+
+// This very simple API is only meant for facilitating wireless debugging via the Bluetooth Bee module through the UART
+// Note: the API inherits the Serial class's functions: printf(), getc(), sscan(), etc.
+// however the Serial class's "setup" functions, such as baud() and format() will not behave as you expect; thus don't use them
+// Bluetooth Bee wiki: http://www.seeedstudio.com/wiki/index.php?title=Bluetooth_Bee
+
+#ifndef BLUETOOTHBEE_H
+#define BLUETOOTHBEE_H
+
+#include "mbed.h"
+
+class BluetoothBee: public Serial {
+public:
+    BluetoothBee(PinName tx, PinName rx);
+    void setup();
+};
+
+#endif
\ No newline at end of file
--- a/main.cpp	Fri Mar 30 19:49:10 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#include "mbed.h"
-#include "BluetoothBee.h"
-
-BluetoothBee b(p9,p10);
-Serial pc(USBTX, USBRX);
-
-int main() {
-    b.setup();
-    
-  // Bluetooth Bee now visible; pair with device (open Terminal program such as PuTTY)
-    
-    b.printf("hello world\n");
-    return 0;
-}
\ No newline at end of file
--- a/mbed.bld	Fri Mar 30 19:49:10 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479