First post here, hope you’ll be able to help me . I think it’s a simple problem, but I’m king of new in programming.
I’m building a simple linear rail with a Nema17 and a A4988 and I want to be able to move the carriage with 2 buttons. It should be momentary buttons, meaning the carriage should move until you release the button (or when it reached the limit of determined steps).
I have a limit switch to reset the position to 0 if that’s pertinent.
My goal is to use this device standalone sometimes (without HA), so I want something embedded in ESPHome, would it be possible ?
Right now everything is working fine, but I can’t figure how to properly set those momentary button
So here is the code for the motor and the homing switch. Now I want D1 to jog the motor UP. It’s more the process of ‘‘calculating’’ the steps when manually moving the motor than the actual switch.
I’m not so familiar with stepper motor control, but I think one way to do it would be like this pseudo code. Can’t help much with the details of stepper control.
on_press of jog_up
while id jog_up is on
Run the following script:
Move the stepper motor a small amount
delay a small amount
wait for the script to finish
*Loop again.
I don’t know if there is a smarter way to do that. Maybe something to do with checking the number of steps left before issuing a new small increment?
I have the same idea, but first I don’t want to use script as I want to be able to use the devide standalone without HA. Also, I’m certainely not able to manually code these steps to make it work.
I’ve been searching the whole internet for few days and I didn’t find anythind, either on Arduino or HA… I can’t belive as this is basically a 3D printer… Thanks !