hello! i have been working on a simple simulation code, but i cant get it to work. when i try to use this code to set the location[0] or location[1], nothing happens:
It makes no sense to have serialRead == 'x' as part of the while statement. It might make sense to have an if statement containing the while statement.
But, not really. It makes no sense to keep reading serial data ad storing every thing in location[0]. location[0] can only hold one byte.
You need to read and store whatever serial data has arrived, until the end of packet marker arrives. Then, parse the data. Not sending an end of packet marker? Start sending one or forget ever writing code that works.
So, let's say the first character in the buffer is an 'x'.
Let's also say that the output buffer is empty, so the Serial.println takes almost no time at all.
Then you read another character.
Oops.