   //use this to move servos left and right
   moveLeft(resL);
   moveRight(resR);
+  Serial.println(resL);
+  //Serial.println(resR);
 
 
   delay(100);//let move for some time then stop
+  stopRedbot();
+  delay(10);
   //train
   brainL.train(eval(l, c, r), resL);
   brainR.train(eval(r, c, l), resR);
 
-
+ //}
 }
 
 
 //***** sensor function******
 
 int eval(int l, int c, int r) {
-   if((l > LINETHRESHOLD) && (c > LINETHRESHOLD) && (r > LINETHRESHOLD) )
+   if ((l > LINETHRESHOLD) && (c > LINETHRESHOLD) && (r > LINETHRESHOLD) )
 	{
             return 1;
 	}

{


  int l = left.read();
  int r = right.read();
  int c = center.read();
  //set inputs
  brainL.inputs[0] = l;
  brainL.inputs[1] = r;
  brainR.inputs[0] = l;
  brainR.inputs[1] = r;

  //feed forward and calculate weighted sum
  int resL = brainL.feedForward();



void moveLeft(char d) {
  leftSpeed = -(SPEED - 50);
  if (d > 0) {
    //Serial.println(d);
    motors.drive(-80);
    
  delay(1000);       // for 1000 ms.
  } else {
    //motors.leftMotor(100);//180
    //motors.rightMotor(150); // Turn on right motor clockwise medium power (motorPower = 150) 
    motors.leftDrive(-255);
    motors.leftMotor(80); // Turn on left motor counter clockwise medium power (motorPower = 150) 
  }
}

void moveRight(char d) {
   rightSpeed = SPEED - 50;
  if (d > 0) {
    //motors.rightMotor(-100);//180
    //motors.drive(-255);
    motors.rightDrive(-255);
    motors.rightMotor(80); // Turn on right motor clockwise medium power (motorPower = 150) 
    //motors.leftMotor(-150); // Turn on left motor counter clockwise medium power (motorPower = 150) 
  } else {
   motors.drive(80);
  }
}


void stopRedbot() {
  motors.brake();

}
