I want to create a system that can send messages between android app with arduino using bluetooth module. I Used bluetooth terminal (android) made by qwerty
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
String Data = "";
void setup()
{
mySerial.begin(9600);
}
void loop() // run over and over
{
while(mySerial.available()==0)
{}
char character;
while(mySerial.available()>0)
{
character = mySerial.read();
mySerial.write(character);
}
data = data + character;
if (character == 13) {
mySerial.print("Received: ");
mySerial.println(data);
data = "";
}
}
Everything it's ok when I send single character, but if I send string data (more than 1 character) arduino can't received it correctly. always error data in second character received.
Anyone can describe and help me to solve the problem? Any response are appreciated.
If solved the problem, I will posted the guide.