Relay Trouble

We are having a problem using a Relay object. Whenever we add a relay to our C++ code the drivers station indicates No Robot Code. We have used victors, digital inputs and solenoids with no problem but add a relay and no code. We have imaged the cRIO with the 2011 image, have updated Windriver and are using the 2011 WPILib. We’ve even tried a second cRIO, digital module and sidecar.

Does anyone know what could be causing this?

Without seeing the code that breaks your program, we can only guess. Show us something we can check for problems and we might be able to help.

Right now the code to define a relay looks like this:

Relay *abcRelay;

abcRelay = new Relay(3);

The first line is globally defined and the second line is in a function called Init_Controls which is called from IRobot which is the constructor for the IterativeRobot class. Until I just checked the code, I was thinking that Init_Controls was called from RobotInit so this might be part of the problem but digital_inputs and solenoids are defined in the same function and work fine. It is the addition of the second line that kills the code.

Context means everything, please post your full source code. if it is large. If there are secrets about your robot design in your source code, then trim and rename variables only as necessary, but do not change the context in which abcRelay is used.

Edit: I would recommend placing the assignment in your constructor.

Well I got to thinking about this problem and why we see it and nobody else does. We didn’t have much code in the project we were using so I decided to delete it and start over. I carefully followed the instructions to add the example project FRC Default Program and that worked. I then added a relay and that also worked so I modified the project like before and everything is working. I thought we had done this a couple of days ago but apparently not.

I’m sorry I didn’t think to try this before I posted but I’m glad it’s working so we can move on. Thanks for your comments.