Hi guys,
I’ve been trying to initiate my bluetooth bee module in slave discovery mode with no success with the following setup:
-
I have a Seeeduino and a Bees Shield. The switch on the shield is set to ‘Atmega’ which means to me that I want the bee module to communicate with the board and not usb (think this is correct). The Bee1Rx and Tx jumpers are set to 8 for Tx and 9 for Rx. I have also placed the bee module on BEE1 socket on the shield
-
The code I am trying to initialize the module is the following:
#include <NewSoftSerial.h> //Software Serial Port
#define RxD 9
#define TxD 8
NewSoftSerial blueToothSerial(RxD,TxD);
void setup()
{
Serial.begin(38400); //Serial port for debugging, Comment this line if not required
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
setupBlueToothConnection();
}
void loop()
{
}
void setupBlueToothConnection()
{
//Serial.print("Setting up Bluetooth link"); //For debugging, Comment this line if not required
blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
delay(1000);
sendBlueToothCommand("\r\n+STWMOD=0\r\n");
sendBlueToothCommand("\r\n+STNA=modem\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.
blueToothSerial.print("\r\n+INQ=1\r\n");
delay(2000); // This delay is required.
Serial.print("Setup complete");
}
void sendBlueToothCommand(char command[])
{
blueToothSerial.print(command);
delay(3000);
}
I power the shield through my laptop’s usb and I only got a constant green blink (every one sec) on the bluetooth module and nothing else.
I have also tried to talk to it through the serial, by changing the switch to ‘usb’ on the shield and using the following code:
void setup()
{
Serial.begin(38400);
pinMode(13, OUTPUT);
setupBlueToothConnection();
}
void loop()
{
//just to know when sending BT commands is over
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000);
}
void setupBlueToothConnection()
{
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.
}
//Checks if the response "OK" is received
void sendBlueToothCommand(char command[])
{
Serial.print(command);
delay(3000);
}
But again no luck!
Any ideas?