I am trying to interface with a HC-06 module but I can't talk to the module over serial.
My VCC is connected to 5V (also tried 3.3V) of my Arduino Uno, and GND is connected to ground of it (obviously). I've connected the RXD to pin 11 and TXD to pin 10 (also tried the opposite too). The LED on the module is blinking (waiting for connection) Here is my code:
#define BT_RX 10
#define BT_TX 11
#define BAUD 9600
SoftwareSerial bt(BT_RX, BT_TX);
in setup method:
pinMode(BT_RX, INPUT);
pinMode(BT_TX, OUTPUT);
bt.begin(BAUD);
Then, I'm trying to send the simplest AT
command to the HC-06 (without newline character, I do know it's different from HC-05). If everything works, I should get an OK
response. I've tried all the baud rates available, both 3.3V and 5V, and tried inverting the RX and TX pins, yet I've got a response from the module. However, the module itself works. When powered on, my Bluetooth devices see it as HC-06
and can connect to it with the default password 1234 (other passwords fail). When my devices connect to it, the blinking light turns to solid ON, meaning that the connection succeeded. My serial console (when I connect using putty or SerialTools etc) can accept input. The Bluetooth module itself does send and receive data. When I short the RXD and TXD pins, I immediately receive what I typed back in my terminal. But I couldn't find any way to talk to the device over Arduino. I've read many tutorials and datasheets of the device, but I just can't talk to it. I am new to electronics (but most of the times understand what's going on easily). What am I doing wrong?