Beginner need help.

Hi,

I try to send value with an index thru serial with 2 arduino.
I can read correcty on the second arduino but i have a problem of latency when i call a function.

on the second arduino the code is
if(Serial1.available()>0){
a=Serial1.read();
b=Serial1.parseInt()}

i can have the index a and the value b: (E for index and 1 for value or E and 0)(button push or release on the first arduino)

but when i put
if (a=='E'){
if (b==1){
moveBackward();}
}

when i send E1 thru the first arduino the function take 1 second to begin and when i send E0 the function stopped directly with no latency.

when i send quickly E1 E0 (push button and release), the function is called one time but only when i release....
I don't understand...

Post your code.
Use code tags.

when i send E1 thru the first arduino the function take 1 second to begin

That’s how long it takes parseInt() to recognize that you are not going to send more data. Put the crutches away, and learn to send, receive, and parse serial data properly.