ArduinoGeneral

PLL control mode DFRobot L298 Shield

userHead bartrocs 2014-07-03 06:48:53 3308 Views3 Replies
Hi, I have one of the L298 motor shields and was wondering how to use the PLL speed control mode. When I move the jumpers over to the ones labelled PLL, I seem to only have either full on or full off functionality. Any help would be greatly appreciated.
2014-07-04 18:33:42 Hello bartrocs,

Yeah, it is a little confused.
If you want the code clearly, you will find it only exchange M1& E1 and  M2&E2,
For the arduino only have 6 PWM  pins(3,5,6,9,10,11), if you want to change the speed, it only could use this pins as the speed control pin. This is why, you only get  either full on or full off functionality.(it can't control the speed)

hey, if you add the delay time in the code, for example 300ms, you will find the motor clockwise rotate slower, and then it anticlockwise rotate faster. The critical value is about 127.
Or you could give it a constant value.
userHeadPic Grey.CC
2014-07-04 05:18:51 What you have provided seems to be just a different version of the PWM code on the wiki with the variable names M1/2 and E1/2 changed around (integer values fed into the digitalWrite and analogWrite functions are the same). When I put the jumpers to the PLL position, this code does not work at all, whereas it works fine in PWM mode. userHeadPic bartrocs
2014-07-04 01:39:07 I am sorry,

There are something wrong with the sample code.
You can try this code?
//Arduino PLL Speed Control?
int E1 = 4; 
int M1 = 5;
int E2 = 7;                       
int M2 = 6;                         

void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
}

void loop()
{
  int value;
  for(value = 0 ; value <= 255; value+=5)
  {
    digitalWrite(E1,HIGH); 
    digitalWrite(E2, HIGH);     
    analogWrite(M1, value);  //PLL Speed Control
    analogWrite(M2, value);  //PLL Speed Control
    delay(30);
  } 
}
It should be work.
Sorry for the inconvenient.
userHeadPic Grey.CC