-1

Here's the code. Whenever i wrote a AT command in Serial Monitor it do nothing.No response.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {

Serial.begin(9600);

pinMode(9,OUTPUT); digitalWrite(9,HIGH);

Serial.println("Enter AT commands:");

mySerial.begin(9600);

}

void loop()

{

if (mySerial.available())

Serial.write(mySerial.read());

if (Serial.available())

mySerial.write(Serial.read());

}
1

You'll need to be sure your SoftwareSerial's baud rate matches the HC-06's baud rate. The data sheet I have claims the HC-06's default rate is 9600 baud, but as there are commands to change it, it may not be in its factory condition right now.

You may have to try sending AT+VERSION at various SoftwareSerial baud rates until one of them gets you an intelligible reply from the device. Then send a command to set its baud rate (see data sheet) to whatever rate you want it to work at. 9600 is about max for SoftwareSerial.

The new baud rate will survive power-downs.

0

Check The wiring to ensure you have made correct hookup enter code here according to your sketch.

and Try this

if(mySerial.available() > 0)      // Send data only when you receive data:
{
      data = Serial.read();        //Read the incoming data & store into data
      Serial.print(data);          //Print Value inside data in Serial  
}

or you can use AltSoftSerial.hook your BT to pins 8 & 9 and It is much more efficient than SoftwareSerial, and it will not interfere with Serial reads and writes.

Not the answer you're looking for? Browse other questions tagged or ask your own question.