 
 
   void loop() {
+    int x;
+    int y;
+    x = y = input();
     drive();//continuously drive motor
+
     Serial.println(i);
   }
   void drive(int x, int y)//sends control signal to motor shield

    int speed1;//speed right motor
    int direction0 = CW; //direction left motor
    int direction1 = CW; //direction right motor
    calcultateSpeedDirection (x, y);//calculate parameters
    speed0 = map(velocityLeft, 0, controllerMax, 0, 255);
    speed1 = map(velocityRight, 0, controllerMax, 0, 255);
    adjustMotor(0, direction0, speed0);//run left motor
    adjustMotor (1, direction1, speed1);//run right motor
  }

      digitalWrite(inBpin[motor], LOW);
    analogWrite(pwmpin[motor], pwm);
  }
  void calcultateSpeedDirection (int x, int y, int *vL, int *vR, int *dL, int *dR) //converts input in controller-format to suitable combination of track movements
  {
    *vL = (x / 2) + y;//compute velociy left track
    if (*vL < 0)// if needed change left direction
    {
      *dL = CCW;
    }
    *vR = ((-x) / 2) + y;//see Left
    if (*vR < 0)
    {
      *dR = CCW;//see Left
    }
    *vL = map(*vL, 0, controllerMax, 0, 255);
    *vR = map(*vR, 0, controllerMax, 0, 255);
  }
