How to get the last error for while loop? I just want transfer the last error for while loop, but the program use the shift register shift all error every cycle.
What do you mean by "get" and "transfer"?
If the shift register is not what you want, use a plan tunnel instead.
Typically, programmers are interested in the first, not last, error.
Can you show us your code so we have a better idea what you are trying to?
If you stop the while loop with an error condition, the first error should be automatically the last error 😉
And this is basically the best question Christian arises: why do you want to proceed with the loop even though there already is an error, but are interested in the LAST error instead of the FIRST error?