That should be INPUT_PULLUP, or better still add some physical pullups to the encoder lines, perhaps 4k7 sort of value, to prevent noise-pickup affecting the count.
That should be INPUT_PULLUP, or better still add some physical pullups to the encoder lines, perhaps 4k7 sort of value, to prevent noise-pickup affecting the count.