Motor with non-directional encoder arduino library

OP #6962273
Rate this post
• ▲ useful
▼ not useful
Hello all,

I bought the following actuator on the internet:

https://de.aliexpress.com/item/4000374091344.html?gatewayAdapt=glo2deu&pdp_ext_f=%7B%22sku_id%22:%2210000001530238467%22,%22ship_from%22:%22%22%7D&gps-id=pcStoreJustForYou&scm=1007.23125.137358.0&scm_id=1007.23125.137358.0&scm-url=1007.23125.137358.0&pvid=3541ffb2-6450-4523-9788-89953e9fbd28&spm=a2g0o.store_pc_home.smartJustForYou_825606946.1

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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.