Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   need help with motors (http://www.chiefdelphi.com/forums/showthread.php?t=73752)

EagleMentor 06-02-2009 16:22

need help with motors
 
We know this is probably simple, but we are having trouble. In LABVIEW, we want a motor to run for x seconds, say 5 seconds, then stop. Is there something more elegant to stopping a motor in x seconds other than putting it in a loop?

Thanks for any help.

bronxbomber92 06-02-2009 16:59

Re: need help with motors
 
I'm not positive what you're asking, but I think you want this:

Code:

if( joyStick.GetRawButton( 2 ) ) {
    motorSpeedController.Set( 1.0f ); // where motorSpeedController is either a Victor or Jaguar, run it at full forward
} else {
    motorSpeedController.Set( 0.0f ); // stop the motor when button two isn't pressed
}


EagleMentor 06-02-2009 17:25

Re: need help with motors
 
Thank you so much for your help. Sorry. We weren't clear. We are in LABVIEW, but your code actually helped us validate the values of 1 (run forward) and 0 (stop). We are that new to all this.

Greg McKaskle 06-02-2009 17:37

Re: need help with motors
 
One way is to use the Feed and Delay VI. This should work pretty well if used in autonomous, or even in independent loops. It will not work well in teleop or in other loops meant to loop quickly. For those, you want to start the motor and note the time. Use a shift register or a feedback wire to compare the time each iteration to the start time and stop when enough time has elapsed. What you are building is a tiny state machine, and you can of course go further with it to include other states and other transitions.

Greg McKaskle


All times are GMT -5. The time now is 02:25.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi