Communication b/w Java Monkey Engine and Arduino

PaulS:
Where is the code that writes to the serial port? Is it writing binary values or strings?

   if (abs(servoval) >= 360)servoval = 0;

Serial.println(servoval);
   servoval = ((float)Serial.read())/100;
   myservo.write(servoval);



Where is the call to Serial.available() to determine that there is anything to read?

Serial.read() returns a byte, containing a value in the range 0 to 255. You are casting that to a float. Why?

You are then performing integer division. Why?



> When this code is implemented, only the change in the servo value is written to the servo.


Then, why are you treating it as an absolute value?

Hey. Thanks for responding.

Are you talking about the Java code that writes to the serial port? It is writing strings. I didn't know that Serial.available() was a command. I'm very new to Arduino programming, and sending data over serial in general. I'll try that next time I get a chance.

A single call to Serial.read() can only return one byte? So Serial.available() must be used as the condition for a while loop with Serial.read() to put the string back together?

if (abs(servoval) >= 360)servoval = 0; This line is probably superfluous. I think it may just be a remnant from some testing that I was doing. In any case, there are two FSRs, one that adds to the servo's value, and one that detracts from it. This presents the possibility of the servo going farther than -360 or 360 degrees, which will cause the servo to stop working unless it is reset to 0.

Thanks again for your help.