Sending multiply string from APP to ARDUINO via bluetooth

Hello! i have some problems in communicating arduino with app inventor via Bluetooth. I'm trying to send number and message every time when i got sms. As i noticed to let the arduino program know what is being sent at the moment, i should add a prefix or send byte before string. In prefix case, arduino is losing first character of string and program cant identify it. Is there any better option or trick how to indetify properly? Please see at attachment pic and code. image

void loop() {
if(Serial.available() > 0)
byteFromApp =;
strFromApp = Serial.readString();

Serial.println("test tablicy");

arrSms[0][0] = strFromApp;
tft.setTextColor(ST77XX_WHITE, ST77XX_RED);


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.

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() {

void loop() {
String strFromApp = "";
char byteFromApp;

while (Serial.available())
byteFromApp =;
strFromApp = strFromApp + byteFromApp;


1 Like

Uskiara - thank you for your time!

I use arduino UNO with HC06.
I tried your receiving routine, according to losing first character of the string - its fixed it.
Anyway script is going crazy a bit.

It add messages to array randomly.
In that case, It should be 111111 - Test1; 222222 - Test2; 333333 - Test3
In my receiving routine its working well, despite the delay, but as i wrote up, unfortunately its losing first char.

I added also delay 2-3s at the end of loop.
I will study the attached script in my free time, but I'm afraid it won't help in this case.

Try this example:

do not send \n

String texto;
String a ;
String b;
float suma = 0.0;

void setup() {

void loop() {
if(Serial.available()) {
// texto = Serial.readString();
// Serial.println(texto);
a = Serial.readStringUntil(',');
b = Serial.readStringUntil('\n');
// suma = a.toFloat() + b.toFloat();
// Serial.println(suma);

Its not bad way, but in my case there will be few more strings sending to arduino and i need to separate it. The best choice would be that code in prefix.
I checked it, and if It looks like its not losing char when I'm sending number+","messageText" just from this prefix.

i mean that a few more kind of notifications.

Dear @first,
if you didn't fix it yet, it seems that the while loop is too fast.
Try to put a 1 millisecond deay between two reads()
something like
while (Serial.available())
byteFromApp =;
strFromApp = strFromApp + byteFromApp;
for (i = 1; i<= 10;i++) delayMicroseconds(100);

Hoping it can help.