wireless debugging via Bluetooth Bee module wiki: http://mbed.org/cookbook/Wireless-Debugging-with-Bluetooth-Bee
BluetoothBee.cpp@2:0c8cd82a5a45, 2012-03-30 (annotated)
- Committer:
- jyam
- Date:
- Fri Mar 30 19:46:07 2012 +0000
- Revision:
- 2:0c8cd82a5a45
- Parent:
- 1:c249137509e7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jyam | 2:0c8cd82a5a45 | 1 | //BluetoothBee.cpp |
jyam | 2:0c8cd82a5a45 | 2 | |
jyam | 2:0c8cd82a5a45 | 3 | #include"BluetoothBee.h" |
jyam | 2:0c8cd82a5a45 | 4 | #include "mbed.h" |
jyam | 2:0c8cd82a5a45 | 5 | |
jyam | 2:0c8cd82a5a45 | 6 | #define WAIT_TIME 2 // wait time; you may need to increase this number for higher reliability (but slower) |
jyam | 2:0c8cd82a5a45 | 7 | |
jyam | 2:0c8cd82a5a45 | 8 | BluetoothBee::BluetoothBee(PinName tx, PinName rx) :Serial(tx,rx) {} |
jyam | 2:0c8cd82a5a45 | 9 | |
jyam | 2:0c8cd82a5a45 | 10 | void BluetoothBee::setup() { |
jyam | 2:0c8cd82a5a45 | 11 | baud(38400); // the Bluetooth Bee defaults to 38400 baud, 8N1 (8 data bits, no parity, 1 stop bit) |
jyam | 2:0c8cd82a5a45 | 12 | // mbed defaults to 9600 8N1; thus, change baud rate to 38400 |
jyam | 2:0c8cd82a5a45 | 13 | printf("\r\n+STWMOD=0\r\n"); // set as slave mode |
jyam | 2:0c8cd82a5a45 | 14 | wait(WAIT_TIME); |
jyam | 2:0c8cd82a5a45 | 15 | printf("\r\n+STNA=BluetoothBee\r\n"); // set device name as "BluetoothBee" |
jyam | 2:0c8cd82a5a45 | 16 | wait(WAIT_TIME); |
jyam | 2:0c8cd82a5a45 | 17 | printf("\r\n+STOAUT=1\r\n"); // allow devices to connect to module |
jyam | 2:0c8cd82a5a45 | 18 | wait(WAIT_TIME); |
jyam | 2:0c8cd82a5a45 | 19 | printf("\r\n+INQ=1\r\n"); // start broadcasting (make device visible) |
jyam | 2:0c8cd82a5a45 | 20 | wait(WAIT_TIME); |
jyam | 0:4e1c16dddbad | 21 | } |