Right. So that's why I originally said that the line in the Arduino code isn't needed.
We seem to have a failure to communicate here. If the physical servo can move from 0 to 180, and the virtual servo can move from 0 to 360, the model DOES NOT match the physical world.
My bad. I meant to say that the value of the servo is sent after being manipulated by the FSR.
Now, this might be interesting to watch. I don't believe I have ever seen a force sensing resistor manipulate a servo. Does it get up and crank the servo around?
But it also takes float input, which is more precise.
void write(int value); // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds
void writeMicroseconds(int value); // Write pulse width in microseconds
Which of those methods "takes float input, which is more precise."?
It seems to be having the same problem though. I also don't think that redeclaring carray each time is very efficient, but I'm not sure how to do it otherwise.
The problem isn't with redeclaring carray each time.
The problem is that serial data transmission takes time.
input += (char)Serial.read();
Whatever serial data has arrived since the last time any data was read is read and stored in a String.
Whatever is in that String object is extracted, converted to an int and divided by 100 and used to position the servo.
Suppose the sender sent "15000". You will get the data in increments "1", "50", "0", "0", maybe.
Prove to yourself that that is what is happening. After the while loop, put a Serial.println(input); statement. What gets printed will not be what you expect.
Your sender needs to send some kind of end-of-packet marker, and the receiver needs to keep reading data until that end of packet marker arrives. Then, and only then, should it interpret and the value.