read String from Serial

hallo, i have project about RC propo, i make rc propo with remote using bluetooth, i use 2 arduino + hc-05.

arduino1 + hc05 = A

arduino2 + hc05 = B

A : send 2 data for controlling speed motor and servo, example : motor = 130 and servo = 90, and i combine using this syntax

String dfinal = 'a'+String(valL)+'b'+String(valR)+'c';

and result :

a130b90c

i using a and b for make different with other value and c end of data, i send using this syntax

Serial.println(dfinal)

okey this problem with B

B: i using this syntax for reading string data from A

var = Serial.read(); Temp = String(var); Data += String(var);

this great, result i can read data from A, maybe sometime error but not problem, i don't know how to try substring this data, i try with this syntax

final1 = Data.indexOf("a"); final2 = Data.indexOf("b"); final3 = Data.indexOf("b"); final3 = Data.indexOf("c");

Serial.println(Data.substring(final1 + 1,final2)); Serial.println(Data.substring(final3 + 1,final4));

but it's not work, someone can help me how to change data from A

a130b90c

to

only 130 and 90

thanks

Go read Robins' tutorial on serial and don't use String with a capital S.

J-M-L: Go read Robins' tutorial on serial and don't use String with a capital S.

okey, thank for your help

You will see there plenty of good examples that will let you achieve AND understand how to do what you want