i have an hc06 module which has to be slave and an hc05 which i successfully configured to be master by AT commands. i connetced each to a seperate arduino (slave to uno and master to nano) I connected Rx_module to Tx_arduino and Tx_module to Rx_arduino on each module. i uploaded a simple testing code which sends "hello" every 1 sec but i am not recieving it on the other end. But i am sure that the modules are connecting to each other based on the change in blinking patterns of both. (each code will be pasted at the end of this text). Note my hc05 default baud rate is 9600 and i think the hc06 as well but it doesnt have a button to go to AT mode to know. so to be sure i even tried changing the hc05 baud rate to 38400 in case thats the one for hc06 but same result
MASTER CODE:
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(1,0); // RX, TX
void setup() {
// Start serial communication with the computer
Serial.begin(9600);
// Start serial communication with the Bluetooth module
bluetooth.begin(9600);
// Notify that the sender is ready
Serial.println("Bluetooth Sender Ready.");
}
void loop() {
// Send "hello" every 1 second
bluetooth.println("hello");
Serial.println("Sent: hello"); // Print to serial monitor for debugging
delay(1000); // Wait for 1 second
}
and SLAVE CODE:
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(0,1); // RX, TX
void setup() {
// Start serial communication with the computer
Serial.begin(9600);
// Start serial communication with the Bluetooth module
bluetooth.begin(9600);
// Notify that the receiver is ready
Serial.println("Bluetooth Receiver Ready");
}
void loop() {
// Check if there is data available to read from the Bluetooth module
if (bluetooth.available()) {
// Read the incoming data as a string
String message = bluetooth.readString();
// Print the received message to the serial monitor
Serial.print("Message Received: ");
Serial.println(message);
}
}