Hi,
UPDATE: At least part of the issue with the Stalker 2.3 is that the Bee socket runs on pins 0 & 1 as does the UartSBee - creating a conflict and, naturally a problem. One solution might be to re-wire to use 2/3, 6/7 or some other. Which I did try and had no results, well, no good results.
UPDATE: I’ve severed the connections on pads P5 and P6 and soldered the other pads so that the Bee is using pins 6 & 7 for serial communication - this was partially to solve the UartSBee conflict as it also uses pins 1 and 0 for serial connections. Result: I can at least have the Stalker attached to my PC while I work and attempt to solve the problem - I still can’t get it to actually be “inquirable” (no red & amber LED flashing).
So I have a Stalker 3 that I’m attempting to add a bluetooth bee based on an HC-5 chip. I can get it to work on the UartSBee - which is nice, but the settings of course are not permanent.
I’ve been trying the following code to set up the BT Bee - and it’s not been working. So what am I doing wrong?
/* Upload this sketch into Seeeduino and press reset*/
#include <SoftwareSerial.h> //Software Serial Port
#define RxD 7
#define TxD 6
#define DEBUG_ENABLED 1
SoftwareSerial blueToothSerial(RxD,TxD);
void setup()
{
Serial.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();
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
delay(2000);
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
blueToothSerial.print("\r\n +STPIN=0000\r\n");//PIN for pairing
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();
}