0

I have been creating the example for bluetooth communication with arduino with hc_05 Problem I am facing are below.

String statuss= "1.00,2.00,3.00";
bluetooth.print(statuss);
Serial.print(statuss);

This is the code where is get only last 2 digits i.e 00 in android while its showing me complete string in serial monitor.

String statuss= "Hello";
bluetooth.print(statuss);
Serial.print(statuss); 

Then I get the output as ello in Android n in Serial monitor it show Hello

Can Anybody suggest the whats the problem

2
  • 1
    Try with "1.23,4.56,7.89" and tell us what you get. – user31481 Nov 18 '17 at 9:15
  • Do you use the Softwareserial lib? Do you set a speed higher than 19200 bauds? If you answer YES to these two questions, you'll have problem. SoftwareSerial is bugged and lost byte when speed is higher than 19200. – Peter Nov 19 '17 at 22:26
0

I suspect (at first sight) a speed problem. Android runs Bluetooth at 115200 Bauds. So you must set your HC-05 o HC-06 at this speed to get proper result.

But as you perform "bluetooth.print(statuss);" and also "Serial.print(statuss);" this mean you have created a virtual port, probably using the Software Serial lib. Unfortunatly, this lib is not very efective. At speed higher than 19200 Bauds, you lost data (I've had a lot of problem with that before understanding!!) The only right way is to use directly the RX and TX port of the Arduino (pin 0 and 1) and use (eg) a LCD Display to display data and help you debugging your Arduino code (as when you plug the HC on Pin 0 and 1 you lost the access to the serial monitor).

A trick: with the HC on pin 0 and 1, each time you send the sketck to the Ardino, you must unplug RX as it's used for sending the code.

Hope this will help.

-1

It is difficult to know your exact problem since you have not provided your code. However, I believe that you don't have a clear starting bit and a clear end bit, so that the modules don't know when to Start and End.

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.