I am having a connection problem with my BT Shield. I would like to be able to stream music data
through my BT Shield but unfortunately, I can only transmit characters through the terminal. I am
able to connect with my shield through a computer, as in I can see it appear in Bluetooth devices
and I can connect to it and talk to it through a terminal, but I cannot send music data through it, or
any other data. One would think that once I sync with my shield through a computer, the connection
should just resemble a port and should handle any data. But to my computer, it does know what the
connection is other than it being there.
Any help would be nice.
Hi,there are maybe something wrong with your program, could you show us your code, so we could have a try.
/* Upload this sketch into Seeeduino and press reset*/
#include <SoftwareSerial.h> //Software Serial Port
#define RxDB 6
#define TxDB 7
#define RxD 2
#define TxD 3
#define DEBUG_ENABLED 1
SoftwareSerial blueToothSerial(RxDB,TxDB);
SoftwareSerial xBeeSerial(RxD,TxD);
void setup()
{
Serial.begin(9600);
pinMode(RxDB, INPUT);
pinMode(TxDB, OUTPUT);
xBeeSerial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();
}
void loop()
{
char recvChar;
while(1){
if(blueToothSerial.available()){//check if there’s any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
xBeeSerial.print(recvChar);
Serial.print(recvChar);
}
if(Serial.available()){//check if there’s any data sent from the local serial terminal, you can add the other applications here
recvChar = Serial.read();
blueToothSerial.print(recvChar);
}
}
}
void setupBlueToothConnection()
{
blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as “SeeedBTSlave”
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
Serial.println(“The slave bluetooth is inquirable!”);
delay(2000); // This delay is required.
blueToothSerial.flush();
}
The important part is the bluetooth parts,
we are trying to transmit the bluetooth data through Xbees but we havent gotten past the bluetooth parts yet.
try removing the while(1){} loop as I was having the same issue but different setup this is what helped me, maybe will help you as well.