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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BluetoothBee.cpp Source File

BluetoothBee.cpp

00001 //BluetoothBee.cpp
00002 
00003 #include"BluetoothBee.h"
00004 #include "mbed.h"
00005 
00006 #define WAIT_TIME  2                        // wait time; you may need to increase this number for higher reliability (but slower) 
00007 
00008 BluetoothBee::BluetoothBee(PinName tx, PinName rx) :Serial(tx,rx) {}
00009 
00010 void BluetoothBee::setup() {
00011     baud(115200);                            // the Bluetooth Bee defaults to 38400 baud, 8N1 (8 data bits, no parity, 1 stop bit)
00012                                             // mbed defaults to 9600 8N1; thus, change baud rate to 38400
00013     printf("\r\n+STWMOD=0\r\n");            // set as slave mode
00014     wait(WAIT_TIME);
00015     printf("\r\n+STNA=Microbots\r\n");   // set device name as "BluetoothBee"
00016     wait(WAIT_TIME);
00017     printf("\r\n+STOAUT=1\r\n");            // allow devices to connect to module
00018     wait(WAIT_TIME);
00019     printf("\r\n+INQ=1\r\n");               // start broadcasting (make device visible)
00020     wait(WAIT_TIME);
00021 }