Communication and responding of app is slow

When the app communicates with the HC-05 module and the arduino it responds 1 to 2 seconds later which is very late for a bluetooth rc car app. What can I do to fix it??

Please export your project and post it here.
Also upload your Arduino source code.

bluetooth.aia (27.4 KB)

int enA = 6;
int in1 = 7;
int in2 = 8;
void setup() {
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);

// Turn off motors - Initial state
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

void loop() {
// put your main code here, to run repeatedly:
String data= Serial.readString();// reading the data received from the bluetooth module
int x=data.toInt();
if(x>=0 && x<256)
case 1000: digitalWrite(enA, LOW);Serial.println("OFF");break; // when a is pressed on the app on your smart phone
case 1001: digitalWrite(enA, HIGH);Serial.println("ON");break; // when d is pressed on the app on your smart phone
case 1002: digitalWrite(in1, HIGH);
digitalWrite(in2,LOW); Serial.println("Forward");break;
case 1003: digitalWrite(in1, LOW);
digitalWrite(in2,HIGH);Serial.println("Reverse"); break;
case 1004: digitalWrite(in1, LOW);
default : break;

But, it does work?
here may be a mismatch with the rate you are sending and what your arduino can handle.
For example, instead of using Slider1.PositionChanged, use a Clock.Timer to catch the position changed events, because the slider is firing these events much too fast.
Also, you are writing text in your arduino, but you are never receiving it in your app. That may cause a problem of buffering data in your phone. Again, use a clock to receive the data. There is plenty of advice in this forum on how to do this.
And, make your delay longer, like 200. You cannot even blink an eye in 50ms.
Cheers, Ghica.

I'm sorry but the solution didn't work. Can you plz elaborate or send me a link to clock.timer so that I can understand it
Thanks, Ron

Which solution did not work, and how did it not work??
That is not very helpful, if you want further advice.
Anyway, I adapted your .aia, but I cannot test it, for lack of a suitable arduino.
bluetooth_2.aia (28.3 KB)
Here are the clock blocks I added:
blocks (41) blocks (39)
Here, instead of using the slider position changed event, which fires very fast, I used a clock at a slower rate, and a variable to save the old thumb postion.
blocks (40)
Then, you send a lot of text to the app, which you do not read. That is done periodically with the other clock. For this to work, you must set the delimiter byte in the BleutoothClient to 10 in the designer. (I did that for you in my .aia). And, you must use println(...) in your arduino sketch to delinit a message, which you do I believe.

I added a label to display what you get. When your app is finished, you can delete this label or make it invisible.

Now, set the delay in your arduino sketch to 300 or so.

See what happens. We are trying to speed things up by making everything slower. Sounds strange. but it may help the arduino to cope with too many messages.
In case this does not help, upload your .ino file too.
Let us know.
Cheers, Ghica.

had the same problem, adjusting how the Arduino parses serial data solved the issue.

from my understanding, serial data arrives in a buffer ( BTSerial.available(); ) one character at a time with a small delay between each. You can either handle data one character at a time using, or you can process the whole buffer together at a set interval using BTSerial.readString().

The problem you are having is because you are using the BTSerial.readString() method. in order to return a string from a stream of characters, the readString(); method waits a default timeout interval of 1000ms (roughly the delay you were experiencing). So even if your data arrives in the first 10ms, the readString(); method waits another 990ms before concatenating the buffer into a String. However, if you would like to stick with the readString(); method, you can shorten the timeout interval by adjusting BTSerial.setTimeout(int ms);

A better method would be to design your handling function around the; method. Concatenate each incoming character into a string and use a delimeter byte to signal the end of incoming data:

void loop() {
  data = "";
  c = 0x0;
  while (c != ';') { 
    if (BTSerial.available() > 0) {
      c =;

      if (c != ';') {
        data += c;

  //handle data


A better programmer than myself may have a better solution but hopefully that will save you the time I spent researching and designing this solution.

Are you providing a solution? If yes, then try to avoid necroposting (posting in old topics after a year or 2).

yes I am providing a solution. Not really sure why the age of the discussion matters since it's still the first thing that shows up on Google for people with the same issue. Had someone posted that single line of code before me, I would have saved at least an extra hour of research.