analogWrite not working with PLL

Hello,
I am using an Intel Galileo Gen2 with a DFROBOT motor shield. The power and wiring is all correct but still the analogWrite is not working, and I need to move the wheels backward. I cannot use the PWM because of the conflict it causes with my servo. here is a sample code that is not working:

Arduino PLL Speed Control
int E1 = 7;   
int M1 = 6;
int E2 = 4;                         
int M2 = 5;                           
 
void setup() 
{ 
    pinMode(M1, OUTPUT);   
    pinMode(M2, OUTPUT); 
    pinMode(E1, OUTPUT);   
    pinMode(E2, OUTPUT); 
} 
 
void loop() 
{ 
//Move forward is woking because of digitalWrite
    digitalWrite(E1,HIGH);   
    digitalWrite(E2, HIGH);       
    analogWrite(M1, 255);
    analogWrite(M2, 255);  
    delay(30);

//Move backward is not working because analog is not
    digitalWrite(E1,HIGH);   
    digitalWrite(E2, HIGH);       
    analogWrite(M1, 0);
    analogWrite(M2, 0);  
    delay(30); 
  }  
}

any advice?

analogWrite() with a value of 255 is NO different from digitalWrite() with a value of HIGH.

analogWrite() with a value of 0 is NO different from digitalWrite() with a value of LOW.

So, your statement about the wheels not moving backwards because PWM is not working is nonsense. Your wheels don't go backwards because you are standing on the brakes.

Try something novel like analogWrite(thePin, 200); so the wheels actually are given some speed to turn at.

The digitalWrite()s on the enable pins are what controls the direction. The analogWrite() is what controls the speed. I think you can envision that 0 is going to be pretty slow.

MelissaG:
I cannot use the PWM because of the conflict it causes with my servo.

The servo library only interferes with PWM (analogWrite() ) on two pins.

...R

The servo library only interferes with PWM (analogWrite() ) on two pins.

Depending on how many servos you have...

PaulS:
Depending on how many servos you have...

That is not what the RTFM says for an Uno

...R

The code is the authority. And, it has changed. The Servo class used to be limited as to the number of servos that could be controlled with one timer. Apparently, something has changed to remove that limit.

PaulS:
Apparently, something has changed to remove that limit.

And nobody bothered to document it, of course.

I will stick with my IDE 1.5.6

...R

I will stick with my IDE 1.5.6

Well, the change was from 0023 to 1.0...

PaulS:
Well, the change was from 0023 to 1.0...

Jeez - and still the documentation has not caught up?

I have never tried using more than 2 or maybe 3 servos.

...R

Jeez - and still the documentation has not caught up?

The documentation is accurate. I was relying on my memory of how the Servo library used to work.