   motor4.setSpeed(motorSpeed);
 }
 
-String getDistance(int argument) {
+String measureDistance(int argument) {
+  return String("Ping: ") + String(getDistanceInCm()) + String("cm");
+}
+
+int getDistanceInCm() {
   unsigned int uS = sonar.ping();
-  return String("Ping: ") + String(uS / US_ROUNDTRIP_CM) + String("cm");
-}
+  return uS / US_ROUNDTRIP_CM;
+}

#include <AFMotor.h>
#include <NewPing.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);

int motorSpeed = 100;
bool isMovingForward = false;
bool isMovingBackward = false;
bool safetyDriveMode = true;

String input = "";
  
