DC Motor with Encoder (keeps giving 0s en 1s)

Hi, I bought this motor:

And want to test it out with this library:

And this tutorial:

If I turn it around I only get


In my Serial Monitor. Also it does not matter if I turn clockwise or counter-clockwise.

It should be this:

What should I do to make it count when I am turning it?


/* 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.println("Basic Encoder Test:");

long oldPosition  = -999;

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

Try monitoring the encoder's 'A' and 'B' output phases with a DMM as you turn the motor by hand. Do they operate in the expected sequence?