My Bluetooth doesn't receive data!


actually have problem mybluetooth

first can pair android
i'm using bluetooth terminal

and give me double flash every 2 seconds( means connected)
i'm using bluetooth terminal app android

and wrote code
code: [select]
// basic bluetooth sketch hc-05_02
// connect hc-05 module , communicate using serial monitor
//
// hc-05 defaults commincation mode when first powered on.
// default baud rate communication mode 9600
//
 
#include <softwareserial.h>
softwareserial btserial(0, 1); // rx | tx
// connect hc-05 tx arduino pin 2 rx.
// connect hc-05 rx arduino pin 3 tx through voltage divider.
//
 
char c = ' ';
 
void setup()
{
    serial.begin(9600);
    serial.println("arduino ready");
 
    // hc-05 default serial speed commincation mode 9600
    btserial.begin(9600); 
}
 
void loop()
{
 
    // keep reading hc-05 , send arduino serial monitor
    if (btserial.available())
    { 
        c = btserial.read();
        serial.write(c);
        serial.println(c);
        btserial.write(c);
    }
 
    // keep reading arduino serial monitor , send hc-05
    if (serial.available())
    {
        c =  serial.read();
        btserial.write(c);
        serial.println(c);
    }
 
}


okay, when send data serial  monitor via bluetooth android app, receive data

but when send data application arduino, don't receive data on serial monitor.

so problem?

code: [select]
softwareserial btserial(0, 1); // rx | tx
you can not softwareserial on hardware serial pins while using them hardware serial pins. on it.


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > My Bluetooth doesn't receive data!


arduino

Comments