Rover 5: how to measure distance with one encoder output

I recently bought a Rover 5, Arduino Uno and 2A Motor Shield and made my first sketches.
I would now like to use the encoders to control the motors and I have a question about that.

I would like to measure distance and am not interested in direction.
That must be possible with one encoder output but how?

I experimented with Encoder.h. .
That provides the desired distance information, but requires two encoder outputs (myEnc.Read) – and I only want to use one encoder output.

I also experimented with digitalRead () but that only delivers “1” and “0” and no distance information.

I'm stuck and am looking for help and/or suggestions.

Thanks in advance. Regards, Ko


Thanks for your replies. I solved the distance measuring with an interrupt (sub routine), as follows:


// Sketch @ distance determination with 1 encoder output using an interrupt (INT0)


volatile int distance = 0;


void setup() {

   // EncoderPin attached to pin 2 (Uno INT 0) | for distance measurement with one encoder output!

    attachInterrupt (0,ISR_Encoder,CHANGE);



void loop() {



void ISR_Encoder()


  distance = distance + 1;



Kind regards, Ko