Hi everyone, i built a very basic circuit with the HC05 and i am trying to send data between the Arduino IDE Serial Monitor and my smartphone through a BT-serial monitor. When i type stuff in my arduino serial monitor i recieve everything as normal. But when i try and send something from the monitor on my smartphone, it won't display anything on the monitor from Arduino. I tried it as well with turning a led on and off, but nothing happened, i'm just not able to send anything to my Arduino. I am using pin 0 and 1 on my Arduino Leonardo, i have tried different cables and a different breadboard. Hope somebody knows what the problem might be and hope you can help me out! Thanks in advance
#include <SoftwareSerial.h>
SoftwareSerial bluetoothSerial(0, 1); // RX, TX
void setup() {
Serial.begin(9600); // Serial Monitor
bluetoothSerial.begin(9600); // Bluetooth module
// Set the HC-05 to master or slave mode (AT commands may vary based on your HC-05 version)
bluetoothSerial.print("AT+ROLE=0\r\n"); // 0: Slave mode, 1: Master mode
// Set a recognizable name for your module
bluetoothSerial.print("AT+NAME=MyBluetooth\r\n");
// Set the PIN code for pairing (you can change this)
bluetoothSerial.print("AT+PIN=1234\r\n");
}
void loop() {
if (bluetoothSerial.available()) {
char data = bluetoothSerial.read();
Serial.write(data); // Display data received from Bluetooth module on Serial Monitor
}
if (Serial.available()) {
char data = Serial.read();
bluetoothSerial.write(data); // Send data from Serial Monitor to Bluetooth module
}
}