Hi All...
I am playing with the Seed Studio Bluetooth shield, bought up the road at Radio Shack. I am testing it on two different boards, an Uno and my own 1284P board.
On the Uno, the code below works well, letting me exchange text with my Android phone.
On the 1284P board, I can send text to the phone, but data sent from the phone is not displayed on the terminal, leading me to believe that it is not actually being received.
I have checked the schematic and verified that the pins are correct. I even reversed which were the TX and RX pins, and of course rejumpered the shield, and the problem remained the same, indicating that there is not a hardware problem. I have also tried it with and without the internal pullup enabled.
Any ideas?
Thanks...
#include <SoftwareSerial.h> //Software Serial Port
// Use these for 1284P board
#define RxD 14
#define TxD 15
// Use these for Uno
//#define RxD 6
//#define TxD 7
#define DEBUG_ENABLED 1
SoftwareSerial blueToothSerial(RxD,TxD);
void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
digitalWrite(RxD, HIGH); // enable pullup
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();
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();
}