hello!
I connected Arduino Mega 2560 board and Bluetooth hc-05.
At this time, HC-05 was registered as a Bluetooth device in the mobile phone.
However, the Bluetooth Terminal was unable to communicate with the serial monitor.
Why this is happend and how can I fix this?
Thanks
Is the HC05 EN pin connected to 5V? Is the HC05 RX pin connected directly to the Mega TX pin?
The HC05 inputs are not 5V tolerant and may be damaged by connection to 5V.
pinMode(HC05_KEY, OUTPUT);
digitalWrite(HC05_KEY, HIGH);
For communication mode the EN pin should be LOW or not connected at all.
I tried your code (after removing the screen shot) and tried it on my Mega with HC05. My HC05 has a voltage divider on the Mega TX to HC05 RX to drop the Mega 5V to 3.3V for the HC05 and the EN pin is not connected. The code works fine. I type in serial monitor, it shows up in Bluetooth serial terminal and vice versa.
Thank you very much.
When I did it in the above way, I succeeded in getting the value from the serial monitor to the smartphone.
But Bluetooth to serial monitor communication failed. Is there a solution?
Wiring looks OK. I don't know why the Mega is not receiving. My Mega receives just fine and transmits just as well with the posted code. The best advice that I can offer, at this point, is to try a different HC05 module.