Arduino receiving number from Flash

Hi there.
First time writing here at the forum so, wish me luck! =)

I’m working on a flash + arduino project, but I’m having a lot of trouble making both transfer data. I’m using SerProxy and XMLSocket, and I want Flash to control a Servo through Arduino, sending a number from 0 to 180. Simple as that.
Thing is, is Flash only capable of sending strings through XMLSocket? It sends objects, right? So when I send a Byte of a ByteArray, my Arduino receives the corresponding Ascii code of that number written on the ByteArray!
Ok. After trying hard to send a pure Byte to Arduino I surrended. Now I’m trying to receive a string from flash, say ‘140’, reading character through character, and converting it to an INT so I can tell the servo to move. I don’t know why but the servo always move to 180 degrees… What am I doing wrong? Heres the code:

#include <Servo.h>

Servo myServo;
int pinServo = 9;
char inStr[4];
void setup()

void loop()
  if (Serial.available()) {
    int i = 0;
    while (Serial.available()){
      inStr[i] =;
    Serial.println(atoi(inStr));    //Just to see in Flash if arduino is receiving the data right. 
                                   //But println sends 3 characters separately to Flash as if it was still a String, not INT converted.


inStr[i] = '\0';

after the i++; to properly terminate the string.

Then, after the Serial.available() block, Serial.println(inStr) to confirm that the string was received correctly.

Then, store the value returned by atoi in an int, and Serial.print that int.

You should be able to determine what is wrong, depending on what gets printed.

Of course, Paul! Thank you for your answer! I'll do that, probably will work just fine.