Encoder.h Basic example not counting correctly

I am trying to do just a basic test of the Encoder.h library and I was using the basic example, but it is not counting correctly. I get alternating 0’s and 1’s on the Serial Monitor and LCD display. My assumption from looking through the code from Paul, the original author of the library, and watching his Youtube videos is that the counter should be going up and down based on which direction you turn the encoder. Any ideas of what would cause this?

#include <LiquidCrystal.h>

#include <Encoder.h>

Encoder myEnc(D1, D2);
//   avoid using pins with LEDs attached

LiquidCrystal lcd(D3, D4, D5, D6, D7, D8);

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

long oldPosition  = -999;

void loop() {
  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
    oldPosition = newPosition;
    lcd.setCursor(0, 1);

Solved the issue. It was a hardware problem, not software.