|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Running Motor for X Milliseconds
Hello,
I'm working on programming our kicker which our team would like to wind up at certain tensions. To do this, I want to have the CIM motor to run for a certain amount of milliseconds if one button is pressed on the joystick. It would be nice if I could use a couple different buttons for different times. Then use a limit switch to tell the motor so stop all the way back no matter what time I select. However, I am not sure how to make the motor set speed vi to run continuously for a set amount of time. Does anyone have any ideas on how I can achieve that? Thanks for your help. Dillon Wirth |
|
#2
|
||||
|
||||
|
Re: Running Motor for X Milliseconds
I just posted a reply in a different thread that almost applies to your situation.
It's not exactly what you're looking for, but it involves writing code that runs in TeleOp, but takes longer than the 20msec main-loop time. It involves using shift registers to provide feedback from loop-to-loop in your teleop routines. Here's a link to that thread. |
|
#3
|
|||||
|
|||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MIG welder feed motor always running | sanddrag | Electrical | 14 | 11-09-2006 09:46 |
| DC Motor running as a Generator | IrisLab | Motors | 16 | 12-01-2004 12:23 |
| A vampire running for office | MissInformation | Chit-Chat | 2 | 30-08-2003 14:36 |
| Running a motor for a set time in auton | Morgoth | Programming | 5 | 11-03-2003 13:59 |