HC-05 serial passthrough

I'm being challenged by a very simple issue that is really straight forward and I must be missing something obvious.

HC-05, and a Nano Every
The HC-05 connected through P2 and P3 for Software Serial
USB connected to Nano

Code looks like this:
#include <SoftwareSerial.h>
//2 = Rx
//3 = Tx
SoftwareSerial serial(2,3);

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

while(!Serial){
;
}
Serial.println("Starting Up");
serial.begin(115200);
delay(500);

}

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

}
}

When I type into the serial monitor on the USB side the strings come out properly on the Bluetooth side, however when I type into the bluetooth side, I get some odd output.

I type:
"Hello World Test Test"
and the output in the serial monitor is:
"Hdllow WosldTdstTdst"

if I type:
testtesttesttesttesttest
I get
tdsttdsttdsttdsttdsttdsttdsttdsttdsttdst

What am I missing here?

Please follow the advice given in the link below when posting code. Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

If you indeed have the HC05 configured for 115200 baud rate, you should probably try connect the module to the the second hardware serial port on the Nano Every.

There are two hardware serial ports on the Nano Every. The USB connector goes to the Serial Monitor. Chip Pins PC05 and PC04 are connected to the pins marked "RX and TX" on the Nano Every's Arduino pin headers. These are available as a separate hardware serial port accessed as Serial1.

Thanks for the advice.
I believe that problem I had was with the tolerances on the BT module, I spun it down to 38400bps and there's no problems, but when I push it higher than that it just gets dumb.

That makes sense if you are still using SoftwareSerial. Despite what the reference says, 38400 is as fast as one can expect SoftwareSerial to work. You should be able to go much faster if you use the second hardware port like @cattledog said.

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