Oh okay, I should have explained it better. Sorry.
The sketch I posted, was showing a whole PCB for driving two motors.
When I used that board to drive two motors using 4 different signals: L_PWM, L_DIR, R_PWM and R_DIR, it worked just fine.
However, when I drove the two motors with just...