Actuation problems with my motor controller.

LarryD:

void loop() 

{
  int value;
  for(value = 0 ; value <= 255; value+=5)
  {
    digitalWrite(M1,HIGH);   
    digitalWrite(M2,HIGH);       
    analogWrite(E1, value);   //PWM Speed Control
    analogWrite(E2, value);   //PWM Speed Control
    delay(30);
  } 
}



If you are using the code sample from the link it is not appropriate for a solenoid valve.
Crazylgels suggestion is OK.
OR
Use a power N-MOSFET.

I remember that I was able to make it work with the 24 V solenoid valve. I just used 255 for full voltage and 0 for 0 voltage.
So what would I do instead?