|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
HELP PLEASE!!
hi, i am a new programmer on my team, Can anyone please tell me how to program a spike in c++
![]() Quote:
Last edited by krudeboy51 : 25-03-2010 at 01:27. |
|
#2
|
||||
|
||||
|
Re: HELP!!
Define the spike as:
Code:
Relay *[variable here] Code:
[variable name used above] = new Relay([Relay port it's plugged into on the DSC]) Code:
[variable name]->Set(Relay::kForward) -OR- [variable name]->Set(Relay::kReverse) -OR- [variable name]->Set(Relay::kOff) |
|
#3
|
|||
|
|||
|
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.
}
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |