# Forum: µC & Digital Electronics Motor with non-directional encoder arduino library

Rate this post
 • ▲ useful ▼ not useful
Hello all,

I bought the following actuator on the internet:

There are the following pins: M+, M-, GND, C and A. By changing the
polarity of M+ and M- I can control the direction of the motor.
At C I give 5V, GND is clear and at A I simply measure 0V or 5V
depending on the position of the motor. I would like to drive the motor
with a L298n module. Most PID libraries I have seen use an encoder with
2 pulses to determine the direction. But since I define the direction of
the motor with the H-bridge circuit of the L298n I only need 1 pulse for
the speed (I don't have any more anyways). Now my question: is there a
library which makes it easy to control a motor with a non-directional
encoder?

Thanks for your answers

• $formula (LaTeX syntax)$