Problem HC-05 and Android

HELP ME!

How must i configure my hc-05 for send/receive data from arduino to android,

Actually my hc-05 is slave, receive data from android but not send yet,
My hc-05 slave is… AT+ROLE=0
AT+UART=9600,0,0

This is my codec on arduino for send and receive data

char entrada;
int a=1;
int v=1;
#include <SoftwareSerial.h>
SoftwareSerial conexion(10,11);//RX|TX
void setup()
{
pinMode(7,OUTPUT);
conexion.begin(9600);
digitalWrite(7,LOW);
}

void loop()
{
if(conexion.available()>0)
{
entrada=conexion.read();
if(entrada==‘1’)
{
digitalWrite(7,HIGH);
conexion.write(entrada);
delay(200);
}
//conexion.write(entrada);
}
}

You do not need any configuration to send data. You can connect it to pins 0,1 and use the same programme you would use to send the data to the serial monitor

fipinedasant:
HELP ME!

How must i configure my hc-05 for send/receive data from arduino to android,

I did something like this recently.

Here’s my sketch.
I use SoftwareSerial library.
I use the Bluetooth Terminal app on Android smartphone to communicate to the Arduino.
The Serial Monitor displays every byte sent from the Android.
You could easily add code to communicate from Arduino back to Android by using BTserial.println( );

#include <SoftwareSerial.h>

SoftwareSerial BTserial(13, 12);
// Connect the HC-05 TX to Arduino pin D13. 
// Connect the HC-05 RX to Arduino pin D12 through a voltage divider.
 

void setup() 
{
    Serial.begin(9600);
    Serial.println("Arduino is ready");
 
    BTserial.begin(9600;  
    Serial.println("BTserial started at 9600");
}
 
void loop()
{
    char aByte;

    if (BTserial.available() > 0)
    {
        // text arrived in from BT serial

        //
        aByte = BTserial.read();
        Serial.println(aByte);

    }

}

Nick_Pyner: You do not need any configuration to send data. You can connect it to pins 0,1 and use the same programme you would use to send the data to the serial monitor

I have my HC-05 as slave and not work for send data from arduino to android, some idea?

ieee488:
I did something like this recently.

Here’s my sketch.
I use SoftwareSerial library.
I use the Bluetooth Terminal app on Android smartphone to communicate to the Arduino.
The Serial Monitor displays every byte sent from the Android.
You could easily add code to communicate from Arduino back to Android by using BTserial.println( );

#include <SoftwareSerial.h>

SoftwareSerial BTserial(13, 12);
// Connect the HC-05 TX to Arduino pin D13.
// Connect the HC-05 RX to Arduino pin D12 through a voltage divider.

void setup()
{
   Serial.begin(9600);
   Serial.println(“Arduino is ready”);

BTserial.begin(9600;  
   Serial.println(“BTserial started at 9600”);
}

void loop()
{
   char aByte;

if (BTserial.available() > 0)
   {
       // text arrived in from BT serial

//
       aByte = BTserial.read();
       Serial.println(aByte);

}

}

You are using “BTprint” for call your SoftwareSerial, i have my SoftwareSerial as “conexion”, your codec and the me is almost same

#include <SoftwareSerial.h>
SoftwareSerial conexion(10,11);//RX|TX

I did not have to do anything to my HC-05 to make it work.

You simply need to pair it with your Android smartphone and start using a Bluetooth Terminal app.

With my sketch if you don't see BTserial started at 9600 displayed in the Bluetooth Terminal app, then something is wrong.

I modified my sketch from the one I found at http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-at-mode/

ieee488: I did not have to do anything to my HC-05 to make it work.

You simply need to pair it with your Android smartphone and start using a Bluetooth Terminal app.

With my sketch if you don't see BTserial started at 9600 displayed in the Bluetooth Terminal app, then something is wrong.

I modified my sketch from the one I found at http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-at-mode/

With HC-05 you can use it as slave or master, my question main is, how do you need to configure your bluetooth with command AT for that you bluetooth send/receive data?

fipinedasant: my question main is, how do you need to configure your bluetooth with command AT for that you bluetooth send/receive data?

It might be a struggle, but you could start by trying to read reply #1 again. The first sentence only will suffice. The only time you need to have an HC-05 as a master is when you need it to establish the connection. This has nothing to do with sending or receiving, and is never required when you are using an Android device, as the Android is used to make the connection. Once a connection is established, it does not matter which is master or which is slave.

You might find the following background notes useful

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino