Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Setting the speed on a jaguar in C++ (http://www.chiefdelphi.com/forums/showthread.php?t=73332)

DillonMartine 31-01-2009 14:05

Setting the speed on a jaguar in C++
 
Hello all,

When setting the speed of a jaguar

To drive our robot we are using one jaguar. When the joystick y axis is move above neutral we plan to have the speed of the jaguar increase untill it reaches max. once its at max, we want the motor to continue to move untill the joystick is returned to neutral.

if(stickc->GetY()> 0 && driveflagf==0){
drive->Set(0);
speed = 0;
for(int counter=0;counter<=5;counter++)
{

speed = speed +.2;
drive->Set(speed);
Wait(1);
}
driveflagf = 1;}
if (stickc->GetY()>0 && driveflagf==1){

drive->Set(1);
}
if (stickc->GetY()== 0){
drive->Set(0);



Would the above code accomplish this? we have tested just setting the speed of a jaguar to max by hitting a button, but the jaguar seems to only turn on for a second..
Any Ideas?

programMORT11 31-01-2009 21:32

Re: Setting the speed on a jaguar in C++
 
have you made sure that driveflagf is a static variable?

DillonMartine 31-01-2009 22:31

Re: Setting the speed on a jaguar in C++
 
Yes its static.. Technically the code should work as intended no?

elcron 01-02-2009 11:26

Re: Setting the speed on a jaguar in C++
 
Try holding down the button.


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

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