|
Re: Running Motor for X Milliseconds
It sounds like what you want is in three parts. First, start a motor running forward when a button is pressed. Second, stop the motor a certain amount of time after the motor is started. Third, if the motor isn't running forward, run it backward until a limit switch activates. Is that right?
You'll need a "rising edge detector" to find the start of the button press. Then you'll want something that runs the motor until a certain time has elapsed. The attached code fragment shows a way to do that.
I'll leave it up to you to figure out how to make the motor run the other way only when it's not being told to run forward and the limit switch is not active.
|