Use a arduino as a rotary encoder

There are
3 pin rotary encoders
4 pin rotary encoders
5 pin rotary encoders
some of them creating a single pulse for each "tick"
some of them creating 4 pulses for each "tick"
some of them with overlapping pulses
some of them with not overlapping pulses

writing about

does not deliver enough information to be able to write a mimicking code

  • method 1: post a link to the datasheet of your rotary-encoder

  • method 2: use the 3D-printers name to look up spareparts of your 3D-printer to find a type-number of the rotary-encoder

  • method 3: take a four channel digital storage oscilloscope to record the signals on all channels of the rotary-encoder

  • method 4: take a two channel digital storage oscilloscope to record the signals on two channels of the rotary-encoder

  • method 5: measure the signal-voltages on the output-pins of your rotary-encoder and if they don't exceed 5V buy a 10$ 8 channel logical analyser to record the signals of the output-channels

  • method 6: make a lot of assumings how this particular rotary-encoder works and write a code that mimiks this behaviour testing if the mimiking is successful
    If it does not work change one assuming and try again
    repeat until successful

  • method 7: describe the final purpose of mimiking the rotary-encoder
    This will enable to make suggestions how the same final purpose can be achieved with much easier to apply methods

now which method do you choose?

best regards Stefan
Be the change you want to see in the world

This notion of be the change you want to see in the world does 3 powerful things when we adopt it:
It stops us from judging others;
It replaces complaining about others with reflection on self;
It stirs us into taking action within the only thing in the world over which we have any control: ourselves.