 void Backward(int time) // inverse voltage of both motors
 {
   Serial.println("move backward");
-	setMotors(DEFAULT_SPEED, BACKWARD);
-	delay(time);
-	Stop();
-	delay(STOP_TIME);
+  setMotors(DEFAULT_SPEED, BACKWARD);
+  delay(time);
+  Stop();
+  delay(STOP_TIME);
   /*digitalWrite(motor1PinA, LOW);
   digitalWrite(motor1PinB, HIGH);
   digitalWrite(motor2PinA, LOW);

}

void setMotors(int speed, int direction) {
	setMotorLeft(speed, direction);
	setMotorRight(speed, direction);
}

void setMotorLeft(int speed, int direction) {
	int controlBit = direction == FORWARD ? 1 : 0;
  analogWrite(enablePin_1, speed);
  digitalWrite(in1Pin_1, controlBit);
  digitalWrite(in2Pin_1, ! controlBit);
}

void setMotorRight(int speed, int direction) {
	int controlBit = direction == FORWARD ? 1 : 0;
  analogWrite(enablePin_2, speed);
  digitalWrite(in3Pin_2, ! controlBit);
  digitalWrite(in4Pin_2, controlBit);
}

void computeMeans() {
	int dimension = 1;
	int clusters = 3;
	double errorTolerance = 0.01;
	double** centroids = (double**)calloc(clusters, sizeof(double*));

	int* labels = k_means(dataPoints, numDataPoints, dimension, clusters, errorTolerance, centroids);
	for (int i = 0; i < numDataPoints; i++) {
		aprintf("data point %d is in cluster %d\n", dataPoints[i][0]	, labels[i]);
	}
	free(labels);
	free(centroids);
}

void collectIntialData() {
	int* values = getSensorValues();
	dataPoints[collectedPoints][0] = (double) values[0];
	dataPoints[collectedPoints + 1][0] = (double) values[1];
	dataPoints[collectedPoints + 2][0] = (double) values[2];
	dataPoints[collectedPoints + 3][0] = (double) values[3];
}

int* getSensorValues() {
	int values[4];
	values[0] = analogRead(diod1Pin);
	values[1] = analogRead(diod2Pin);
	values[2] = analogRead(diod3Pin);
	values[3] = analogRead(diod4Pin);
	Serial.println("" + values[0] + values[1] + values[2] + values[3]);
	return values;
}

void RotateRight(int time) // inverse voltage of only one motor
{
  Serial.println("rotate right");
  setMotorLeft(DEFAULT_SPEED, FORWARD);
  setMotorRight(DEFAULT_SPEED, BACKWARD);
  delay(time);
  Stop();
  delay(STOP_TIME);
}

void Stop()
