user47907: My setup is using an Uno r3, and the motor driver is an L289N.
I am going to set it to run at a lower RPM, but when adjusting enA or enB to set to below 130, it won't spin.
// connect motor controller pins to Arduino digital pins
// motor one
int enA = 2;
int enB = 7;
int in3 = 5;
int in4 = 6;
int in1 = 3;
int in2 = 4;

void setup()
{
  // set all the motor control pins to outputs
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}
void demoOne()
{
  analogWrite(enB, 130);
  // turn on motor B
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  delay(500);
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(5000);
  // this function will run the motors in both directions at a fixed speed
  // turn on motor A
  // set speed to 200 out of possible range 0~255
  analogWrite(enA, 130);
  // turn on motor B
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  // set speed to 200 out of possible range 0~255
  delay(100); //this function to set masa untuk rotation
  // now change motor directions
  // now turn off motor
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(200);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  delay(200); 
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(100);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);

  analogWrite(enB, 130);
  // turn on motor B
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  delay(400);
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(5000);
}

void loop()
{
  demoOne();
  delay(3000);

}


user43025: Looks like you are controlling two motor outputs via the H-bridge, where the logic inputs are in1,in2 and in3,in4.  First of all, you need
pinMode(in1,OUTPUT);
pinmode(in2,OUTPUT);

One reason why the motors may not spin for analogWrite value less than 130 is that, coincidentally, the voltage output is too low and motor stalls.  Test this two ways: does (1) changing the motor supply voltage or (2) changing the argument of analogWrite actually change the speed?  
If no, it may be that pinMode(enA,OUTPUT); sets the output as digital and should be removed.  In that case a number less than 128 gets interpreted as a logic 0 and the motor will not spin.
P.S. your code can be neatened up using port syntax and bitwise operators.
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);

can be written on a single line with
PORTD |= _BV(in1);

Also
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);

becomes
PORTD &= ~(_BV(in1) | _BV(in2));


47907: <p>My setup is using an Uno r3, and the motor driver is an L289N.</p>

<p>I am going to set it to run at a lower RPM, but when adjusting <code>enA</code> or <code>enB</code> to set to below 130, it won't spin.</p>

<pre><code>// connect motor controller pins to Arduino digital pins
// motor one
int enA = 2;
int enB = 7;
int in3 = 5;
int in4 = 6;
int in1 = 3;
int in2 = 4;

void setup()
{
  // set all the motor control pins to outputs
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}
void demoOne()
{
  analogWrite(enB, 130);
  // turn on motor B
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  delay(500);
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(5000);
  // this function will run the motors in both directions at a fixed speed
  // turn on motor A
  // set speed to 200 out of possible range 0~255
  analogWrite(enA, 130);
  // turn on motor B
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  // set speed to 200 out of possible range 0~255
  delay(100); //this function to set masa untuk rotation
  // now change motor directions
  // now turn off motor
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(200);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  delay(200); 
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(100);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  delay(5000);

  analogWrite(enB, 130);
  // turn on motor B
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  delay(400);
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(5000);
}

void loop()
{
  demoOne();
  delay(3000);

}
</code></pre>
 43025: <p>Looks like you are controlling two motor outputs via the H-bridge, where the logic inputs are <code>in1,in2</code> and <code>in3,in4</code>.  First of all, you need</p>

<pre><code>pinMode(in1,OUTPUT);
pinmode(in2,OUTPUT);
</code></pre>

<p>One reason why the motors may not spin for analogWrite value less than 130 is that, coincidentally, the voltage output is too low and motor stalls.  Test this two ways: does (1) changing the motor supply voltage or (2) changing the argument of <code>analogWrite</code> actually change the speed?  </p>

<p>If no, it may be that <code>pinMode(enA,OUTPUT);</code> sets the output as digital and should be removed.  In that case a number less than 128 gets interpreted as a logic 0 and the motor will not spin.</p>

<p>P.S. your code can be neatened up using port syntax and bitwise operators.</p>

<pre><code>digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
</code></pre>

<p>can be written on a single line with</p>

<pre><code>PORTD |= _BV(in1);
</code></pre>

<p>Also</p>

<pre><code>digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
</code></pre>

<p>becomes</p>

<pre><code>PORTD &amp;= ~(_BV(in1) | _BV(in2));
</code></pre>
