No it won’t - sorry
You seem not to read any data from Serial1 in the last example.
And since you are not resetting stringPos
you’ll run out of inString[]
corrupting other memory.
And since you are not terminating your string with '\0'
once you drop out of your digit acquisitioning if-statement, your atoi
will probably fail or give you wrong results.
But if I were you, I’d not go down the string route anyway, unless you want to present the data transmitted data in human readable form.
Since you are using the transmitted value as a number anyway, I’d stick with write()
and receive the bytes directly into the int
variable. And I’d read both bytes in one iteration of loop()
. You are pushing out both bytes in one iteration of the Arduino loop()
, too.