Commincation between an adroid app and an arduino.

I am trying to send text between my arduino and my android app that I created with app inventor.

Sending from a bluetooth client in app inventor works fine but send text the other way does not work.

If I send MySerial.print("DONE") from the arduino, I get it back as "ONED" or "D" and then "ONE" when I call Bluetoothclient1.ReceiveText()

What is going wrong here? Is this a delimiter problem, i.e. BlueToothClient1 expecting different string delimters to what the arduino is sending?

What is going wrong here?

One end or the other is making incorrect assumptions about what constitutes a packet.

“” makes it perfectly clear what constitutes a packet.
“DONEDONE” does not.

Is this a delimiter problem, i.e. BlueToothClient1 expecting different string delimters to what the arduino is sending?

Who knows? You didn’t post any code.

PaulS:
One end or the other is making incorrect assumptions about what constitutes a packet.

“” makes it perfectly clear what constitutes a packet.
“DONEDONE” does not.
Who knows? You didn’t post any code.

Well I am expecting app inventor bluetooth client to behave like arduino when it comes to serial strings.

You Serial.println(“DONE”) at one end and Serial.reasString() = “DONE” at the other and it all works nice and simply.

But I can’t find any way to make App inventor read the string accurately no matter what I use in the arduino code.

Serial.println(“DONE”) does not work.

Serial.print(“DONE”) does not work.

This is what I have in app inventor:

Actually maybe it is not a delimiter problem so much as a synchronization problem.

The android CPU is probably faster than the arduino CPU and so it is completing the read on a serial connection before the arduino has finished writing the string to the connection.

Sychronisation, due to the differing speeds of the CPUs on both devices was definitely the problem.

Using a known text delimiter on the Arduino, as you suggested, plus the following in my android app works:

I disable the button in the android app and then use the above as delay before enabling the button again.

Then my app buttons are always in synch with my arduino LEDs.