How to call different "Serial" in the same function ?

Your messages always have an endmarker the "!"

and it seems that you messages even have start-marker "_a"

normal message: _a,int1,int2,int3,int4,int5!

error-message: _a,int1!

and you have value-separators the comma.
This means you can write yur own receive-function that starts storing the characters
after receiving "_a" and goes on with receiving until the "!" is received

Then a flag completeMessageReceived is set true
and you can go on processing the integers
the length already tells you normal data or error

doing it this way enables to receive as fast as you can in a non-blocking way
and still receive everything

read this tutorial. See example 3 of this tutorial

1 Like