I tried to connect it via Arduino (pin default is 1234) but the sketch I used to always false (blueToothSerial.available ()).
Will you help me figure out where I wrong? Thank You.
#include //Software Serial Port
#define RxD 6
#define TxD 7
#define DEBUG_ENABLED 1
SoftwareSerial blueToothSerial(RxD,TxD);
int led = 8;
void setup()
{
Serial.begin(38400);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();
pinMode(led, OUTPUT);
}
void loop()
{
char recvChar;
while(1){
if(blueToothSerial.available()){//check if there\'s any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
if(recvChar == \'a\')
{
digitalWrite(led, HIGH);
}
if(recvChar == \'b\')
{
digitalWrite(led, LOW);
}
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();
}
Hi, please make sure that you have made the correct connection on the 3*8 headers with jumper hats.
HBT_TX -> D6 (RX of Arduino)
HBT_RX -> D7 (TX of Arduino)
It’s a bit different from the picture shown on the wiki. Please try again to see if it works. Thanks!