   {
 
   }
-  void calcultateSpeedDirection (x, y, velocity)//converts input in controller-format to suitable combination of track movements
+  void calcultateSpeedDirection (x, y)//converts input in controller-format to suitable combination of track movements
   {
-
+    int velocityLeft = (x / 2) + y;//compute velociy left track
+    if (velocityLeft < 0)// if needed change left direction
+    {
+      directionLeft = CCW;
+    }
+    int velocityRight = ((-x) / 2) + y;//see Left
+    if (velocityRight < 0)
+    {
+      directionRight = CCW;//see Left
+    }
   }
-

  void loop() {
    drive();//continuously drive motor
  }
  void drive(int x, int y, int velocity)//sends control signal to motor shield
  {
    int speed0;//speed left motor
    int speed1;//speed right motor
    int direction0;//direction left motor
    int direction1;//direction right motor
    calcultateSpeedDirection (x, y, velocity);//calculate parameters
    adjustMotor(0, direction0, speed0);//run left motor
    adjustMotor (1, direction1, speed1);//run right motor
  }

#define CW 0
#define CCW 1


int pwmpin[2] = {5, 6}; // PWM's input
int inApin[2] = {7, 4}; // INA: Clockwise
int inBpin[2] = {8, 9}; // INB: Counterlockwise




void setup() {
  Serial.begin(9600);
