Go to Post Those chief delphi kids...they think they're so pimp... - Eugenia Gabrielov [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-03-2010, 00:17
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
HELP PLEASE!!

hi, i am a new programmer on my team, Can anyone please tell me how to program a spike in c++

Quote:
class:
????
public:
????
please, some one help!!

Last edited by krudeboy51 : 25-03-2010 at 01:27.
  #2   Spotlight this post!  
Unread 25-03-2010, 06:39
Golto's Avatar
Golto Golto is offline
Registered User
AKA: Pat Plude
FRC #4572 (BArlow RobAutics)
Team Role: Mentor
 
Join Date: Oct 2006
Rookie Year: 2007
Location: Bethel, CT
Posts: 91
Golto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of light
Re: HELP!!

Define the spike as:
Code:
Relay *[variable here]
Initialize it as:
Code:
[variable name used above] = new Relay([Relay port it's plugged into on the DSC])
To use it, place where needed in your code like this:
Code:
[variable name]->Set(Relay::kForward)
-OR-
[variable name]->Set(Relay::kReverse)
-OR-
[variable name]->Set(Relay::kOff)
__________________
  #3   Spotlight this post!  
Unread 25-03-2010, 06:58
nighterfighter nighterfighter is online now
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: HELP!!

That is one way to do it. However, instead of declaring the Relay as a pointer (*) you can do it this way:

Code:
class Team1771Robot : public SimpleRobot {

RobotDrive driveTrain;
Joystick leftStick;
Joystick rightStick;
Shooter mainShooter;
Relay mySpike; //Declare your spike's name here

public:
	Team1771Robot(void):
 	driveTrain(LEFT_DRIVE_MOTOR_PORT, RIGHT_DRIVE_MOTOR_PORT),
	leftStick(LEFT_JOYSTICK_PORT), 
	rightStick(RIGHT_JOYSTICK_PORT),
	mainShooter(SHOOTER_TENSION_PORT, SHOOTER_RELEASE_PORT),
             mySpike(MYSPIKE_PORT) //Put whatever slot the spike is.

		

	{



	}
	;




Later on in your code, say, in the teleop, you can say

void OperatorControl()
{
while(isOperatorControl() && !isNotDisabled())
{

mySpike.Set(Relay::kOff); //Or forward, reverse, etc.

}
}
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP!!!! we need help w/ compressors/pneumatics for teleop/autonomous in LABVIEW rokenboker NI LabVIEW 9 05-02-2010 17:10
Grab Frame - Help Help Help... nmihailidis Programming 2 04-03-2007 14:44
section 'InterruptVectorLow' type is non-overlay (was: HELP HELP HELP!!!!!) naor52 Programming 14 24-02-2007 01:19
Help: How do we get a teacher to help? (was: Help) ChaosAlchimey General Forum 13 21-01-2007 11:57


All times are GMT -5. The time now is 03:37.

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