Why is this HC-06 code not working?

Why this doesnt work?
RX connected to pin 10
TX connected to pin 11

#include <SoftwareSerial.h>

SoftwareSerial BT (10, 11);
void setup() {
  Serial.begin(9600);
  Serial.write("Ready");
  BT.begin(38400);
}

void loop() {
 if(BT.available()){
  Serial.write(BT.read());
 }
 if(Serial.available()){
  BT.write(Serial.read());
 }
}

If these are two separate modules, which I assume they are, is there a common GND reference wire between the two, or are they sharing a power source? If not, the signal wires have no reference.

Are you sure you pin connection is correct?
If hc12 module and tx on hc12 should be connected to RX on Arduino and RX on hc12 should be connected to TX of Arduino.

The software serial constuctor is from the point of view of the Arduino. You need to cross connect so that the HC06 Tx is connected to the Arduino Rx and the HC06 Rx is connected to the Arduino Tx.

It's best to use a resistance divider on the ArduinoTx to module Rx so that the input voltage is limited to 3.3v.

Does this match to your receiver?

I have already crossed the cables. Yes, it matches my reciever...

Did you try to connect it to any terminal software on the PC? Did it worked at this configuration?

I repeat, from post # 2.

Better would be to use and Android phone?
Can it see and connect to the HC06?
Can a Serial Terminal app like Kai Morich's Serial Bluetooth Terminal send and receive from the HC06?

Software Serial can be problematic at 38400 baud and you may do better to reconfigure to 9600.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.