Thread: C++ Relay Code?
View Single Post
  #1   Spotlight this post!  
Unread 14-07-2009, 17:34
Happyisgood Happyisgood is offline
Registered User
FRC #3161 (Tronic Titans)
Team Role: College Student
 
Join Date: May 2009
Rookie Year: 2009
Location: Canada
Posts: 23
Happyisgood is an unknown quantity at this point
C++ Relay Code?

Hey!

I seem to have a constant stream of programming problems, but here's my problem.

I can get a relay to work in a basic code (two drive motors, left and right, one joystick plus a single relay.) However whenever I try to move the code over to my FULL bot code (with many motors and two Joysticks) the code just fails.

What I'm using is the following (only parts of it)

Code:
#include <WPILib.h>

class RobotDemo public IterativeRobot
{
Relay *hRelay;
Joystick *stickDrive;

public:
RobotDemo()
{
     hRelay = new Relay(1);
     stickDrive = new Joystick(1);
}
void TeleopPeriodic()
{
     if(stickDrive->GetTrigger())
            hRelay->Set(Relay::kForward);
     else
            hRelay->Set(Relay::kOff);
}
};
START_ROBOT_CLASS(RobotDemo);
This is the parts of the code that included any Relay related stuff. If that runs alone (or almost alone) it works, if that runs in the full program, it doesn't. Any suggestions?


EDIT : Perhaps I should rephrase. What could possibly be in my code to cause this particular part of the code not to work?
__________________
2009 - Waterloo Regional - Regional Finalist
2009 - Waterloo Regional - Engineering Inspiration Award


________________________

2009 Team Member 1334

Last edited by Happyisgood : 14-07-2009 at 21:01.
Reply With Quote