   pinMode(5, INPUT); // Set our input pins as such
   pinMode(6, INPUT);
   pinMode(7, INPUT);
+  pinMode(2, INPUT);
 
   // Set up compass
   Wire.begin();

  return 1;
}

void controlMotor(int speed,int direction,float bias){
  
  int biasSpeedL=0.0;
  int biasSpeedR=0.0;
  if(bias==0){

      String direction=(String(rotate->valuestring));
      float bias=0;
      if(direction.equals("LEFT")){
        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\"}");
    }
    if (goforward->type == aJson_Int) {
      int aspeed=goforward->valueint;
      persistantSpeed=aspeed;
      persistantDirection=DIRECTION_FORWARD;
      persistantBias=0;
      persistantRotation=NO_ROTATION;
      Serial.println("{\"response\":\"OK goforward\"}");
    }
    
    if (gobackward->type == aJson_Int) {
      int aspeed=gobackward->valueint;
      persistantSpeed=aspeed;     
      persistantDirection=DIRECTION_BACKWARD;
      persistantBias=0;
      persistantRotation=NO_ROTATION;
     Serial.println("{\"response\":\"OK gobackward\"}");
    }

    
    if (gobackward->type == aJson_String) {
      //lcd.print(String(line3->valuestring));
      persistantSpeed=SPEED_FAST;
      persistantDirection=DIRECTION_BACKWARD;
      persistantBias=0;
      persistantRotation=NO_ROTATION;
     Serial.println("{\"response\":\"OK gobackward\"}");
    } 

    if (stopnow->type == aJson_True) {
      float bias=0;
      controlMotor(0,DIRECTION_STOP,bias,NO_ROTATION);
      persistantSpeed=SPEED_STOP;
      persistantDirection=DIRECTION_STOP;
      persistantBias=0;
      persistantRotation=NO_ROTATION;
      Serial.println("{\"response\":\"OK stopnow\"}");
    }
}

