digitalWrite LOW problem

So I've been working on a robot that has to navigate through a course and search for a candle to put out. The robot navigates by using sensors and is driven by two rear wheels. I was able to get the code working perfectly but when I returned to my robot it no longer worked. I am fairly certain that this new problem is not an issue with the code. Whenever I set motor 1 and/or motor 2 to LOW, the motor/wheel will alternate between forwards and backwards rather than staying backwards. This is only an issue when the motor is set to LOW.

digitalWrite(motor1, HIGH); //Sets forward direction M1

digitalWrite(motor2, LOW); //Sets backward direction M2

analogWrite(E1, speed); //Full speed ahead M1

analogWrite(E2, speed); //Full speed ahead M2

In this sample of my code (turning), motor1 will go forwards and motor2 will alternate rotating forwards and backwards. I have absolutely no idea how to fix this problem, I have tried different versions of arduino, replaced the arduino board, and have fiddled with the code. Please help!!!

ddefilippi:
I was able to get the code working perfectly but when I returned to my robot it no longer worked.

It would have continued to work unless you changed something or some connection came loose in the intervening period.

What did you change?

Have you checked all the connections?

If it is battery powered do you need a new battery?

DO NOT change things just because you think you must do something, anything !

...R