Xbee Bluetooth, una librería modificada para la configuracion y protocolo de comunicación

Files at this revision

API Documentation at this revision

Comitter:
Lucas_eb
Date:
Mon Apr 30 22:11:03 2012 +0000
Commit message:
Xbee Bluetooht

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
diff -r 000000000000 -r 6af096b11230 BluetoothBee.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluetoothBee.cpp	Mon Apr 30 22:11:03 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(115200);                            // 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=Microbots\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);
+}
diff -r 000000000000 -r 6af096b11230 BluetoothBee.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluetoothBee.h	Mon Apr 30 22:11:03 2012 +0000
@@ -0,0 +1,21 @@
+// 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