Using map for DC motor instead of servo
It looks like you want to use the "analogValue" to control the direction and speed of your DC motor.  If this is correct consider using this:

      //This method assumes: The center position of the pot is the motor's 0 speed point,   
      //(because this is an ideal speed to actually reverse the motor's direction).
      //A PWM control range of 0-255, and the ADC input range of 0-1023.  

      //First create a relative speed value from "analogValue",   
      //with the pot mid point at 0 speed, and pot high/low points being full speed.  

      int motorSpeed = 0;  
      if (analogValue &lt; 512 )  
      {  
       motorSpeed = map(analogValue, 0, 511, 255, 0);  
      }  //Note that mapped range is reversed to give 0 speed at mid point.           
      else  
      {  
       motorSpeed = map(analogValue, 512, 1023, 0, 255);  
      }

      //then replace each analogWrite(E1, 255) with:  
      analogWrite(E1, speedValue);  

      //you should also change "  if (analogValue &gt; 2 &amp;&amp; analogValue &lt; 500) {  " to:  
      if (analogValue &lt; 512) {