I endorse what Ash has said.
The board has 2 inputs that control the direction of each motor and 1 that enables/disables the motor
Setting input L1 HIGH and L2 LOW and Enable HIGH will should cause the motor to run in one direction and reversing the states of L1 and L2 will make it run the other way. Putting a PWM signal on Enable will allow you to control the speed of the motor.
In your sketch you have pins defined as follows
int motorSpeed = 8; // motor speed
int motorDir = 9; // motor direction
int enable = 10;
Which inputs of the motor board (L1, L2, Enable) are each of them connected to ?
There are alternative ways of controlling the motor speed by putting PWM on the motor inputs (L1, L2) but that is more unusual although it is how the on line manual for the board suggests that you do it.
Forget the sensor for now. Have you written a sketch that runs the motor at different speeds using either method ?