what input pin is it using?

If the car is not going in a straight line the outer wheel will turn faster than the inner wheel.

I have been assuming that you have done at least a few of the example projects that came with your IDE. They do require some hands-on to teach basics.

Suppose you hook up the sensor and wheel you have and see what you can get from that?
The sensor is digital right? It's either on or off, LOW or HIGH, 0 or 1?

So write code to read the sensor and if it is HIGH you turn a led on (UNO has built-in led on pin 13, I dunno about the MEGA) and if it is LOW you turn the led off. Then turn the wheel and see how the led flickers. If it does not then it's time to check the wiring and the code.

All that does is to ensure that you can read the sensor and get meaningful data.