hi everyone, firs, my english isnāt realy good, and i started playing with electronics recently.
I bought the Bluetoth in seeedstudio, and iām trying to get it working: iām using as arduino uno, i bought also a xbee shiled (only the pcb and de pins), finally, iām using the following code:[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()
{
if(blueToothSerial.read() == āaā)
{
blueToothSerial.println(āYou are connected to Bluetooth Beeā);
//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(int len = blueToothSerial.available())
{
a = blueToothSerial.read();
if('O' == a)
{
b = blueToothSerial.read();
if('K' == b)
{
break;
}
}
}
}
while( (a = blueToothSerial.read()) != -1)
{
//Wait until all response chars are received
}
}
//Send the command to Bluetooth Bee
void sendBlueToothCommand(char command[])
{
blueToothSerial.print(command);
CheckOK();
}[/code] in spit off this, when iām trying to find the device with a cellphone or a laptop, nothing apens, the green keeps blinks two times / second, what iām missing? someone can help me?
regards.