Hello Fellows, this is my first post in this forum and I would like to know if somebody can help me getting the bluetooth bee with the stalker 2.1, I have been reading and trying but without success I could configure and connect the BEE to my PC and worked as a slave but for some reason I can not make it work with the stalker, I tried the wiki example but no luck.
[code]#include <NewSoftSerial.h> //Software Serial Port
#define RxD 11
#define TxD 12
#define DEBUG_ENABLED 1
NewSoftSerial blueToothSerial(RxD,TxD);
void setup()
{
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();
}
void loop()
{
//Typical Bluetoth command - response simulation:
//Type ‘a’ from PC Bluetooth Serial Terminal
//See Bluetooth Bee - Wiki for instructions
if(blueToothSerial.read() == ‘a’)
{
blueToothSerial.println(“You are connected”);
//You can write you BT communication logic here
}
}
void setupBlueToothConnection()
{
blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
delay(1000);
sendBlueToothCommand("\r\n+STWMOD=0\r\n");
sendBlueToothCommand("\r\n+STNA=SeeeduinoBluetooth\r\n");
sendBlueToothCommand("\r\n+STAUTO=0\r\n");
sendBlueToothCommand("\r\n+STOAUT=1\r\n");
sendBlueToothCommand("\r\n +STPIN=0000\r\n");
delay(2000); // This delay is required.
sendBlueToothCommand("\r\n+INQ=1\r\n");
delay(2000); // This delay is required.
}
//Checks if the response “OK” is received
void CheckOK()
{
char a,b;
while(1)
{
if(blueToothSerial.available())
{
a = blueToothSerial.read();
if('O' == a)
{
// Wait for next character K. available() is required in some cases, as K is not immediately available.
while(blueToothSerial.available())
{
b = blueToothSerial.read();
break;
}
if('K' == b)
{
break;
}
}
}
}
while( (a = blueToothSerial.read()) != -1)
{
//Wait until all other response chars are received
}
}
void sendBlueToothCommand(char command[])
{
blueToothSerial.print(command);
CheckOK();
}[/code]
thanks for your help in advance!