Gamepad connected to computer controls servos connected to Arduino board?

The code for Processing won't work on Arduino. How can I convert the code so that it will work on Arduino?

void serialEvent(Serial myPort) 
{ 
  String inString = myPort.readStringUntil('\n');
  if (inString != null) 
  {
    inString = trim(inString);
    float[] colors = float(split(inString, ","));
    if (colors.length >=3) 
    {
      redValue = map(colors[0], 0, 1023, 0, 255);
      greenValue = map(colors[1], 0, 1023, 0, 255);
      blueValue = map(colors[2], 0, 1023, 0, 255);
    }
  }
}