So I am working on a project that uses a DC motor controller and a mega 2560 (amongst other parts) and I am using 2 of the 2560 analog outputs as the forward and reverse buttons. So I am literally cutting the wires off at each of the buttons and connecting one wire to to coordinating analog out (say forward is 5, reverse is 6), and the other to GND, and then when I want the motor to go forward I just write output 5 to high. Now the thing is, this motor runs a linear actuator and when I connect the 2 motor wires (in either polarity), the motor runs in the proper direction but when it hits the end of its travel it just clicks off and stops, despite having it still connected. So if that were on the Mega 2560 I could keep that pin high all day, once it reaches its limit, that's it. But I don't want to keep it high all day. In fact, I want it to read when the limit has been reached and then go low. Without installing any additional hardware, is there a way that I can do this?
Here is all the info on the motor/actuator that I have