     }
   }
   movement(state);
-//  perLeftDist += 350;
+  //  perLeftDist += 350;
 
   //print out values from sensors and motors to the console
   //Serial.print(past);

}

void loop() {
  cur = millis();
  if (digitalRead(hallSensorR), HIGH) {
    if (!prevHallR) {
      prevHallR = true;
      speedArrR[arrPosR % 5] = cur;

      prevHallR = false;
    }
  }
  if (digitalRead(L_Hall), HIGH) {
    if (!prevHallL) {
      prevHallL = true;
      speedArrL[arrPosL % 5] = cur;
