Servo not moving

Hello,

For my studies I need to make an Robotic hand controlled by servos and a Leapmotion.

I can make the connection between my leapmotion and arduino but my servo don't move. I'm already searching a lot but don't find the problem. Can you help me ?

Connection code in Java :

package com.a.d.gip;
import com.leapmotion.leap.*;
import java.io.*;
import java.lang.Math;
import jssc.SerialPort;
import jssc.SerialPortException;

public class Motions {

    public static void main(String[] args) {
        LeapListener listener = new LeapListener();
        Controller controller = new Controller();
        controller.addListener(listener);
        
        System.err.println("Press Enter to quit");
        try
        {
            System.in.read();
        }
        catch (IOException e)
                {
                    e.printStackTrace();
                }
        controller.removeListener(listener);
    }
}

class LeapListener extends Listener{
    //some variabiles for fingers
    //fingers to be counted from left to right... pink to thumb
    int[] fingertips = new int[5];
    Hand hand; //Saves left or right hand position (for getting y distance)
    SerialPort serialport = new SerialPort("COM3");

    public void onConnect(Controller controller)
    {
        System.out.println("Connected");
        controller.enableGesture(Gesture.Type.TYPE_CIRCLE);
    }
    public void onInit(Controller controller)
    {
        //Controller.PolicyFlag current = controller.policyFlags();
        //try opening a serial connection
        try{
            System.out.println("Port opened: " + serialport.openPort());
            System.out.println("Params ok: " + serialport.setParams(9600, 8, 1, 0));
        }
        
        catch (SerialPortException e)
                { 
                    System.out.println(e);
                }
        
    }
    public void onFocusGained(Controller controller)
    {
        System.out.println("Focus Obtained!");
    }
    public void onFocusLost(Controller controller)
    {
        System.out.println("Focus Lost!");
    }
    public void onServiceConnect(Controller controller)
    {
        System.out.println("Service has been attached");
    }
    public void onExit(Controller controller)
    {
        System.out.println("LeapMotion service exited");
    }
    public void onFrame(Controller controller)
    {
        Frame frame = controller.frame(); //frame object for getting hand
        
        //figure out if we have left or right hand detected
        if(frame.hands().leftmost().isLeft())
        {
            hand = frame.hands().leftmost();
            System.out.println("Left hand..");
        }
        
        else
        {
            hand = frame.hands().rightmost();
            System.out.println("Right hand..");
        }
        
        //getting palm hight
        float palmY = hand.palmPosition().getY();
        
        //monitor finger tip position
        FingerList fingers = frame.fingers();
        
        //getting distance of each finger in relation to palm
        Bone[] bones = new Bone[5];
        //finter 0 - 5 -> Thumb, Index, Middle, Ring, Pinky
        bones[0] = fingers.get(Finger.Type.TYPE_THUMB.ordinal()).bone(Bone.Type.TYPE_DISTAL);
        bones[1] = fingers.get(Finger.Type.TYPE_INDEX.ordinal()).bone(Bone.Type.TYPE_DISTAL);
        bones[2] = fingers.get(Finger.Type.TYPE_MIDDLE.ordinal()).bone(Bone.Type.TYPE_DISTAL);
        bones[3] = fingers.get(Finger.Type.TYPE_RING.ordinal()).bone(Bone.Type.TYPE_DISTAL);
        bones[4] = fingers.get(Finger.Type.TYPE_PINKY.ordinal()).bone(Bone.Type.TYPE_DISTAL);
        
        //cut off filtering to prevent odd ranges
        for(int i = 0; i < 5; i++)
        {
           fingertips[i] = (int)palmY - (int)bones[i].center().getY(); 
           if (fingertips[i] > 45)
           {
               fingertips[i] = 45;
           }
           else if (fingertips[i] < 5)
           {
               fingertips[i] = 0;
           }
           System.out.println("Finger " + i + " : " + fingertips[i]);
        }//format is T#I#M#R#P#
        String send = fingertips[0] + "#" + fingertips[1] + "#" + fingertips[2] + "#" + fingertips[3] + "#" + fingertips[4] + "#";
        try{
        System.out.println("Sent packet to Arduino: " + serialport.writeBytes(send.getBytes()));
        //serialport.closePort();
        }
        catch (SerialPortException ex)
        {
            System.out.println(ex);
        }
    }
    
}

Arduino code :

#include <string.h>
//Sketch to recieve LeapMotion data via Serial and control arm
char input[200];
boolean inputComplete = false;
int motorpin = 13;

void setup()
{
  //initialize serial
  Serial.begin(9600);
  //input.reserve(200);
  pinMode(motorpin, OUTPUT);
}

void loop()
{
  if(inputComplete)
  {
    servoControl(input);
    //input = "";
    inputComplete = false;
  }  
}


void serialEvent(){
  while (Serial.available())
  {
    //get a new byte
    byte size = Serial.readBytes(input, 200);
    Serial.print("test");
    input[size] = 0;
    //char inChar = (char)Serial.readA();
    //adding to input string
    //input += inChar;
    //if (inChar == '\n'){
    //  inputComplete = true;
    //}
  }  
}

void servoControl(char* in)
{
  int index = 0;
  char* token = strtok(in, "#");
  while(token != NULL)
  {
      index += atoi(token);
  }
  index = index/5;
  if(index > 5)
  {
    digitalWrite(motorpin, HIGH);
    delay(5);
    digitalWrite(motorpin, LOW);
  }  
}

Thanks in advance !

(deleted)

What should I change because i didn't write the code so i understand it just a litle bit. I don't see where the main program of the adruino write the value ,that he recieved via serial communication, to the servopin ?

Can you help me ?

    servoControl(input);

Isn't this where you use the serial input?

Well, it would be, except that you commented out the code that sets inputComplete to true, so you never call servoControl. I'm reasonably confident that that is why your servo doesn't move.

Well, that and the fact that you are not trying to move a servo correctly in that function, even of you did call it.