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

Committer:
jyam
Date:
Fri Mar 30 18:55:57 2012 +0000
Revision:
0:4e1c16dddbad
Child:
1:c249137509e7
initial publish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jyam 0:4e1c16dddbad 1 //BluetoothBee.cpp
jyam 0:4e1c16dddbad 2
jyam 0:4e1c16dddbad 3 #include"BluetoothBee.h"
jyam 0:4e1c16dddbad 4 #include "mbed.h"
jyam 0:4e1c16dddbad 5
jyam 0:4e1c16dddbad 6 #define WAIT_TIME 2 // wait time; you may need to increase this number if establishing communication keeps failing
jyam 0:4e1c16dddbad 7
jyam 0:4e1c16dddbad 8 BluetoothBee::BluetoothBee(PinName tx, PinName rx) :Serial(tx,rx) {}
jyam 0:4e1c16dddbad 9
jyam 0:4e1c16dddbad 10 void BluetoothBee:: setup() {
jyam 0:4e1c16dddbad 11 baud(38400); // the Bluetooth Bee defaults to 38400 baud, 8N1 (8 data bits, no parity, 1 stop bit)
jyam 0:4e1c16dddbad 12 // mbed defaults to 9600 8N1; thus, change baud rate to 38400
jyam 0:4e1c16dddbad 13 printf("\r\n+STWMOD=0\r\n"); // set as slave mode
jyam 0:4e1c16dddbad 14 wait(WAIT_TIME);
jyam 0:4e1c16dddbad 15 printf("\r\n+STNA=BluetoothBee\r\n"); // set device name as "BluetoothBee"
jyam 0:4e1c16dddbad 16 wait(WAIT_TIME);
jyam 0:4e1c16dddbad 17 printf("\r\n+STOAUT=1\r\n"); // allow devices to connect to module
jyam 0:4e1c16dddbad 18 wait(WAIT_TIME);
jyam 0:4e1c16dddbad 19 printf("\r\n+INQ=1\r\n"); // start broadcasting (make device visible)
jyam 0:4e1c16dddbad 20 wait(WAIT_TIME);
jyam 0:4e1c16dddbad 21 }