Teknic-ClearPath / ClearPath-Arduino-Step-And-Direction

23 stars 20 forks source link

run motor indefinitely #4

Open kenemar opened 3 years ago

kenemar commented 3 years ago

Hi, I'm fairly new to Clearpath; I just found this library a few days ago. I loaded up the SingleAxisDemo program onto my Arduino Uno and I was able to make it work with a Clearpath SD motor. As far as I can find the only way to make the motor run is to call the move() function and specify the length of the move. Is there any way to use this library to tell the motor to run until you tell it to stop? In my case, I would like the motor to run while a digital input is true on the Arduino. Maybe this feature is there, and I just couldn't find it. I'll appreciate any input!

youcangetme commented 3 years ago

This is just a demo to show Arduino does work rather easily with the servo. All you need to do is write the step and direction to two outputs. Direction is either HIGH or LOW whereas you pulse the step HIGH then LOW to create a step. The trick is to wire it as DIRECT and not SINKING. Both will work but SINKING requires a little more thinking (and I get a rash when I have to think ;-)

kenemar commented 3 years ago

Thanks for the answer. I'll have to study into this some more as my experience with Arduino is pretty basic.

youcangetme commented 3 years ago

You can buy an Arduino compatible unit with plugs dedicated for the servos as well as networking, 12v/24v process connections from Teknic. I highly suggest the ClearCore because it is ready wired for the servos and it has libraries ready to use out of the box; https://www.teknic.com/products/io-motion-controller/