Need help for rotary encoder!

Hi!
Today I got a bunch of rotary encoders in the mail. I hooked one up, and it’s working great. I’m using a library called Encoder and this is the code I’m using:

/* Encoder Library - Basic Example
 * http://www.pjrc.com/teensy/td_libs_Encoder.html
 *
 * This example code is in the public domain.
 */

#include <Encoder.h>

// Change these two numbers to the pins connected to your encoder.
//   Best Performance: both pins have interrupt capability
//   Good Performance: only the first pin has interrupt capability
//   Low Performance:  neither pin has interrupt capability
Encoder myEnc(5, 6);
//   avoid using pins with LEDs attached

void setup() {
  Serial.begin(9600);
  Serial.println("Basic Encoder Test:");
}

long oldPosition  = -999;

void loop() {
  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
   oldPosition = newPosition;
    Serial.println(newPosition);
  }
}

The problem is that in every step the value of the rotary encoder increases by 4. I’ts not the library’s fault, but the encoder.
if I divide newPosition by 4, I get this in the serial monitor;

Basic Encoder Test:
0
0
0
0
1
1
1
1
2
2
2
2
3
3
3
3
4
4
4
4
5
5
5
5
6
6
6
6
7
7
7
7

How can I make the the serial monitor output 1 2 3 4 5 6 7 instead?

OH! Silly me! I had to replace long newPosition = myEnc.read(); with long newPosition = myEnc.read() / 4 ;

Well, I’d keep the post if someone else get the same problem :wink: