Hi,
I want to use the bluetooth bee (with this xbee shield: garden.seeedstudio.com/index.php … %AE_Shield) on an Arduino Uno.
But instead of using the newsoftserial library, which is interfering with interrupts elsewhere in my code, I want to just use the hardware serial.
For some reason, every single example code I can find uses the newsoftserial library…
I tried to change the code so it uses the hardware serial instead (replacing blueToothSerial by just Serial), but it doesn’t work!
What’s wrong with this code? I use the pin 13 led to check where the code hangs.
[code]void setup()
{
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
setupBlueToothConnection();
}
void loop()
{
}
void setupBlueToothConnection()
{
Serial.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.
}
void sendBlueToothCommand(char command[])
{
Serial.print(command);
digitalWrite(13, HIGH);
//CheckOK();
delay(3000);
digitalWrite(13, LOW);
delay(1000);
}[/code]
If I use the CheckOK method, the led never goes off, meaning it hangs on the first command, and the bluetooth bee doesn’t send the OK message.
Needless to say the bluetooth bee never enters inquiry mode…
I’ve been successfully using the newsoftserial method, but now I want to use the hardware serial.
Oh, and yes, the switches on the xbee shield are to the right.