Arduino Uno R3 + Xbee Shield + Bluetooth Bee V2: how to?
hi, i'm trying write sketch in order estabilish bluetooth connection between arduino , android.
i have arduino uno r3 + libelium xbee shield + bluetoothbee v2.
in @ mode, can smoothly following commands:
so want make sketch.
searching on forum , reading various tutorials (written different boards , bluetooth bee versions), came this:
but module not initialized , can't proceed further.
note @ commands in serial.print() not same set use @ mode: added at+role=0 set module slave, , removed at+pair , at+link because after doing at+inq phone able pair , connect bluetooth module.
what doing wrong?
tia
i have arduino uno r3 + libelium xbee shield + bluetoothbee v2.
in @ mode, can smoothly following commands:
code: [select]
at+init
at+iac=9e8b33
at+class=0
at+inqm=1,9,48
at+inq
at+pair=mac_address,20
at+link=mac_address
so want make sketch.
searching on forum , reading various tutorials (written different boards , bluetooth bee versions), came this:
code: [select]
#include <softwareserial.h>
const int bluetoothtx = 2;
const int bluetoothrx = 3;
softwareserial bluetooth(bluetoothtx, bluetoothrx);
void setup()
{
pinmode(bluetoothtx, output);
pinmode(bluetoothrx, input);
serial.begin(38400);
bluetooth.begin(9600);
delay(1000);
bluetooth.print("\r\nat+init\r\n"); // inizializzazione spp
bluetooth.print("\r\nat+role=0\r\n"); // imposta come slave
bluetooth.print("\r\nat+iac=9e8b33\r\n"); // impostazione inquire access code di default
bluetooth.print("\r\nat+class=0\r\n"); // accetta in connessione tutte le tipologie di dispositivo
bluetooth.print("\r\nat+inqm=1,9,48\r\n"); // inquire mode: rssi, max 9, timeout 48
bluetooth.print("\r\nat+inq\r\n"); // avvio
delay(1000);
serial.print("bluetooth should initialized now");
}
void loop()
{
if( bluetooth.available() )
serial.print(bluetooth.read());
if( serial.available() )
bluetooth.write(serial.read());
}
but module not initialized , can't proceed further.
note @ commands in serial.print() not same set use @ mode: added at+role=0 set module slave, , removed at+pair , at+link because after doing at+inq phone able pair , connect bluetooth module.
what doing wrong?
tia
quote
but module not initialized , can't proceed further.
what response each of @ commands? helps read response, , send new command when previous 1 responded in positive way. error positive. ok is.
Arduino Forum > Using Arduino > Programming Questions > Arduino Uno R3 + Xbee Shield + Bluetooth Bee V2: how to?
arduino
Comments
Post a Comment