Go to Post If winning that individual match is more important to you than being there in the first place, then I believe you've got your priorities in the wrong spot. - Tom Bottiglieri [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2013, 15:33
realslimschadey realslimschadey is offline
Registered User
FRC #0870 (R.I.C.E.)
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2009
Location: Southold, NY
Posts: 10
realslimschadey is an unknown quantity at this point
Programming Shooter C++

I'm programming in c++ and i cant get the shooter to work. All i want it to do is when i press a button on the joystick, it runs the motor and if im not touching the button the motor doesnt run. How do i do this?
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2013, 16:04
mrklempae mrklempae is offline
Registered User
no team
 
Join Date: Jan 2013
Location: Montana
Posts: 19
mrklempae is an unknown quantity at this point
Re: Programming Shooter C++

I have no idea what your setup is, but it would look something like this:
Code:
while (IsOperatorControl())
		{	           
			bool Button =joystick -> GetRawButton (3);
			if (Button)
			{
				Motor1->Set(1);
                        }
                        else if (!Button)
                        {
                               Motor1->Set(0);
                        }
                }
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2013, 16:53
realslimschadey realslimschadey is offline
Registered User
FRC #0870 (R.I.C.E.)
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2009
Location: Southold, NY
Posts: 10
realslimschadey is an unknown quantity at this point
Re: Programming Shooter C++

The button is 2, and the motor is Shooter. Im still having problems
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2013, 17:35
Arrowhead Arrowhead is offline
Registered User
AKA: Daniel Brown
FRC #1369 (1369 Minotaur)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Tampa, Florida
Posts: 49
Arrowhead is an unknown quantity at this point
Re: Programming Shooter C++

Can you post your current code?
Reply With Quote
  #5   Spotlight this post!  
Unread 11-02-2013, 18:13
JCrusoe JCrusoe is offline
Jacque Crusoe
FRC #3880 (Tiki Techs)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Hawaii
Posts: 5
JCrusoe is an unknown quantity at this point
Smile Re: Programming Shooter C++

Without your current code its hard to tell what the issue is, but I would make sure that you have it in the constructor correctly. I'm going guess that its a Jaguar, but it could easily be a Victor as well.

Code:
#include "WPILib.h"


class RobotDemo : public SimpleRobot
{
	
	Jaguar shooter; 

	Joystick driveStick; //it can be any name, not strictly driveStick :)

public:
	RobotDemo(void):
		
		//JAGUARS//
		shooter(1),	    //This is what port your shooter motor is in on the Sidecar
							
		//JOYSTICKS//	// These must be initialized in the same order
		driveStick(1)	// as they are declared above.
		
	{
		
		shooter.SetExpiration(0.1);  //for Driver Station
		
	}
	
	void Autonomous(void)
	{
			//where your autonomous would go
	}
	
	void OperatorControl(void)	//The Operator Control, what you're looking for!
	{
		while (IsOperatorControl())
		{
			
			if(driveStick.GetRawButton(2)) //This is a structure that says if 2 is pressed, shooter
			{							   //will be set to 100%
				shooter.Set(1.0);
			}
			else                           //anytime when it isn't pressed (else), the shooter will turn
			{							   // off
				shooter.Set(0.0);
			}
			
			Wait(0.005);  // wait for a motor update time
		}
	}
	
	void Test() 
	{
		//what runs during test mode
	}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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