Problem with Arduino Pro Micro & HC-06 (Very Important)

Hi there
I got a problem with my arduino Pro Micro & HC-06 Bluetooth module
When I connect HC-06 to the arduino, I can send data to my phone but I can’t receive any data from phone
I changed the pins many times, used many softwares on my phone,
And also I tried the HC-06 on Uno&Mega and that worked
here is my code:

char a;
#include <SoftwareSerial.h>

SoftwareSerial BT(2, 3); // RX | TX

void setup() {
//  delay(2000);

Serial.begin(9600);
while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
BT.begin(9600);
while (!BT) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

Serial.println("Start");
BT.println("Ready to trancive data");
}

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

  while(BT.available() > 0) {
  
a= BT.read();// read the incoming data as string
Serial.println(a);

  }
}

Tnx a lot :slight_smile:

Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

https://www.arduino.cc/en/Reference/SoftwareSerial

You don't need to use softwareserial. You can use Serial1.begin(9600); instead. The ATmega32U4 has two serial interfaces. One is used by the usb port and the other is on pin 0 and 1.

Thanks a lot !
That Worked :smiley:

Why use SoftwareSerial on a ProMicro when it has a spare HardwareSerial port?

...R

Mil gracias eso me sirvio mucho, llevaba mucho tiempo intentando enviar datos. solo con tu aporte lo pude hacer. Thanks... Thanks... Thanks