first i can pair with it from my android
i’m using Bluetooth terminal
and it give me double flash every 2 seconds( which means that is connected)
i’m using Bluetooth terminal app from android
and i wrote this code
// Basic Bluetooth sketch HC-05_02
// Connect the HC-05 module and communicate using the serial monitor
//
// The HC-05 defaults to commincation mode when first powered on.
// The default baud rate for communication mode is 9600
//
#include <SoftwareSerial.h>
SoftwareSerial BTserial(0, 1); // RX | TX
// Connect the HC-05 TX to Arduino pin 2 RX.
// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.
//
char c = ' ';
void setup()
{
Serial.begin(9600);
Serial.println("Arduino is ready");
// HC-05 default serial speed for commincation mode is 9600
BTserial.begin(9600);
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTserial.available())
{
c = BTserial.read();
Serial.write(c);
Serial.println(c);
BTserial.write(c);
}
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
{
c = Serial.read();
BTserial.write(c);
Serial.println(c);
}
}
okay, when i send data from the serial monitor via bluetooth to the Android app, i receive the data
but when i send data from the application to my arduino, i don’t receive the data on the Serial monitor.
How is your bluetooth device connected to the Arduino? It should be connected to two pins other than 0 and 1, and you should use SoftwareSerial to talk to it. Leave the hardware serial pins available for debugging the code. Add some debugging statements.