 /*
-  K9OS drive motor Sketch
-  Controlls Scooter Motorsl
-  Compass, RC Receiver and
-  Ultrasonic Rangefinder
+ * K9OS drive motor sketch
+ * Controls Scooter Motors,
+ * Compass, RC Receiver and
+ * Ultrasonic Rangefinder
  */
+
 #include <Wire.h> //I2C Arduino Library
 #include <math.h>
 #include <aJSON.h>
 
-// megamoto
+const float pi=3.14159;
+
+// Megamoto Resources
 int EnablePin = 8;
-int duty;
 int PWMPin = 11;  // Timer2
 int PWMPin2 = 3;
 int PWMPinA = 9;  // Timer2

        persistantSpeed=SPEED_FAST;
        persistantDirection=DIRECTION_FORWARD;
        persistantBias=0.5;
        persistantRotation=YES_ROTATION;
      } else {
        persistantSpeed=SPEED_FAST;
        persistantDirection=DIRECTION_FORWARD;
        persistantBias=-0.5;
        persistantRotation=-1;
      }
      Serial.println("{\"response\":\"OK rotate\"}");
    }

//        Serial.println(z);
  int cy=-330;
  int cx=33;

  int dy=y-cy;
  int dx=x-cx;
//    Serial.print("dx,dy=");
