 
 
 void moveLeft(char d) {
+  leftSpeed = -(SPEED - 50);
   if (d > 0) {
-    motors.leftMotor(0);
+    //Serial.println(d);
+    motors.drive(-80);
+    
+  delay(1000);       // for 1000 ms.
   } else {
-    motors.leftMotor(180);
+    //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(180);
+    //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.rightMotor(0);
+   motors.drive(80);
   }
 }
 
-void moveServo(char d) {
-  if (d > 0) {
-    motors.rightMotor(180);
-    motors.leftMotor(0);
-  } else {
-    motors.rightMotor(0);
-    motors.leftMotor(180);
-  }
-}
 
-void stopServo() {
-  motors.stop();
+void stopRedbot() {
+  motors.brake();
 
 }
-
-void turnRedbot(char d) {
-
-    motors.rightMotor(-100);
-    motors.leftMotor(-100); 
-
-}
-
-


void setup()
{
  randomSeed(analogRead(A3));
  brainL.randomize();
  brainR.randomize();
  Serial.begin(9600);

}


{


 
// if(Serial.available())
 //{
  //Serial.println("Goodnight moon!");
  int l = left.read();
  int r = right.read();
  int c = center.read();
  //set inputs
  brainL.inputs[0] = l;
  brainR.inputs[1] = c;
  brainL.inputs[2] = r;
  brainR.inputs[0] = l;
  brainR.inputs[1] = c;
  brainR.inputs[2] = r;

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