0

Im sending data between my arduino and android via bluetooth, using a simple chat app called "Bluetooth Terminal" . the code work perfectly at baudrate(9600) but I need to increase the speed to that of (115200) but nothing gets transmitted, or at least visible, anymore.

here's my code

#include <SoftwareSerial.h>

const int TXD = 3;
const int RXD = 4;
SoftwareSerial mrBlue(TXD, RXD);
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  mrBlue.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:

  if (mrBlue.available() > 0) {

    String data = mrBlue.readString();
    Serial.println(data);



  }

  if (Serial.available() > 0) {

    String data = Serial.readString();
    mrBlue.println(data);
  }


  delay(20);
} 
0

Software serial is not working good with 115200 speed because of too much CPU usage. When I'm using only the bluetooth communication in Arduino, I'm connecting HC-05 (for example) to hardware serial pins and everything works fine.

If you want to increase the speed you must also change it in AT mode.

| improve this answer | |
0

Software serial is really limited because it needs relatively precise timing, full attention of CPU and there can't be any interruptions from other sources.

You can see source code for better understanding how it works.

And if you need faster communication, you should get board with more hardware serials.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.