Is there a chance to distinguish between incoming data (data that comes from the arduino and is printed in the serial window) and outgoing data (stuff that I write into the serial monitor). I get a bunch of data from my arduino to my serial monitor, but I would like to set an if statement, which just runs when I write "Z" into the serial monitor for example.
But what if I send it with my computer to the serial port.
You can't have two applications talking the Arduino at once. So, you can NOT have some other application on the computer sending data to the serial port.
This is part of the code. When I write Z, it should set those two flags to calculate an offset afterwards. The problem is, that the arduino constantly sends values to the port, that I need, so Serial.available() is always > than 0... I mean, with the second statement Serial.read() == 'Z' it kind of works now, but it is more random...
The problem is, that the arduino constantly sends values to the port, that I need, so Serial.available() is always > than 0...
That is horsecrap. What the Arduino sends OUT the serial port has NO bearing on what is IN the incoming buffer. It is that buffer that available() reports on.