Twig Serial Bluetooth problem

Hey,

I’m trying to get works twig serial bluetooth by link garden.seeedstudio.com/Twig_-_Serial_Bluetooth.

I’ve checked twice that it’s connected as need, but I cannot get it work. So, greed LED is blinking, but It doesn’t returning any answers for any command.

So, for example if I’m doing few command and first of them is

sendBlueToothCommand("\r\n+STWMOD=0\r\n");

Then in logs I see only:


+STBD=38400

Can you help me with this?

Sketch is

/*
BluetoothBee Demo Code
2010 Copyright (c) Seeed Technology Inc.  All right reserved.
 
Author: Visweswara R
 
This demo code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
 
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
For more details about the product please check http://www.seeedstudio.com/depot/
 
*/
 
 
/* Upload this sketch into Seeeduino and press reset*/
 
#include <NewSoftSerial.h>   //Software Serial Port
#define RxD 11
#define TxD 12
 
#define DEBUG_ENABLED  1
 
NewSoftSerial blueToothSerial(RxD,TxD);

 
void setup() 
{ 
    Serial.begin(38400);
    
    Serial.println("Hey");
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
    setupBlueToothConnection();
 
} 

void loop() 
{ 
 
  if(blueToothSerial.read() == 'a')
 
  {
    blueToothSerial.println("You are connected to Serial Bluetooth Twig");
    //You can write you BT communication logic here
  }
 
 
}

void setupBlueToothConnection()
{
    blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
    delay(1000);
    sendBlueToothCommand("\r\n+STBD=38400\r\n");
    sendBlueToothCommand("\r\n+STWMOD=0\r\n");
    delay(2000);
    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 CheckOK()
{
  char a,b;
  while(1)
  {
    if(int len = blueToothSerial.available())
    {
    a = blueToothSerial.read();
 
    if('O' == a)
    {
      b = blueToothSerial.read();
      if('K' == b)
      {
        break;
      }
 
    }
   }
  }
 
  while( (a = blueToothSerial.read()) != -1)
  {
    //Wait until all response chars are received
  }
}
 
//Send the command to Serial Bluetooth Twig
void sendBlueToothCommand(char command[])
{
    Serial.println(command);
    blueToothSerial.print(command);
    Serial.println("sent");
    CheckOK();   
}

whick board do you use? The NewSoftSerial library may not support Arduino Mega.

Seeeduino Mega v 1.1

In that case, you can refer to garden.seeedstudio.com/Twig_-_Se … b#Cautions

got it. Now all commands are passing well. But I don’t see this dongle on my PC or any another device.