Hello,
your BT interface on Arduino side is what ? HC05, 06, BLE ?
The Arduino is a UNO, Mega, Nano, ...?
in any case, I've never had to add a "byte" before sending a string to an HC05 or HC06.
Are you sure of that ? Because if you miss the first character of the string, obviously the Arduino code will never catch the synchronization.
I have developed an application called SMS-OT. Please take a sight on it in the IOT category.
title is:
A BT Gateway between a smartphone and Arduino to control SMS-OT (like I-OT)
Maybe it can help.
Cheers, Ugo.
Edit:
I see two delays of 1 second each: how often the AI2 app sends a string to the Arduino ? Hopefully slower than 2 seconds. In other words: only when your app receives an SMS,
And the SMS is sent less often than 2 seconds.I think.
Edit twice: Normally I use this type of receiving routine
void setup() {
Serial.begin(9600);
}
void loop() {
String strFromApp = "";
char byteFromApp;
while (Serial.available())
{
byteFromApp = Serial.read();
strFromApp = strFromApp + byteFromApp;
}
}