Double solenoid code

I’ve been trying to wrap my head around this code for two days now and I can’t figure it out. I’ve got the declaration (DoubleSolenoid festo) and the port set ( festo(1, 2)) what is the code for teleop that gives me control of the solenoid, this is the only thing I can’t get should tell you what you need to know. Briefly, use the Set() method of the DoubleSolenoid class, passing it one of the constant values kOff, kForward, and kReverse.

My line of code for Set() looks like this


festo is the call for our DoubleSolenoid. When i try to build the code I get the following errors:

C:/windriver/workspace/SimpleTemplate/MyRobot.cpp: In member function `virtual void RobotDemo::OperatorControl()':
C:/windriver/workspace/SimpleTemplate/MyRobot.cpp:58: error: `kForward' undeclared (first use this function)
C:/windriver/workspace/SimpleTemplate/MyRobot.cpp:58: error: (Each undeclared identifier is reported only once for each function it appears in.)

Any idea why the Set() I am using is not working?

Because kForward is a member of the DoubleSolenoid class. Use DoubleSolenoid::kForward

Sorry, I am a bit new to C++ (recently switched from labview) where is it that I make the ::kForward, is it in the Teleop, or init?

In the set line that you posted, replace kForward with the text I posted above.

Thanks, the code built correctly I will try this out on the bot today!

Okay, tested the program but I still have an issue.

The code seems to be working, I can see the lights on the FESTO changing as I hit the button on the joystick, however, it seems that the solenoid will not fire. Is this a wiring or more code problem? And how can we get this fixed?

Is it a 12 volt or a 24 volt solenoid? Are you providing it with the voltage it requires?

Do you have enough pneumatic pressure supplied to it for the pilot valve to activate?

24 Volt, I have the wires running from the solenoid breakout board into the FESTO. And as for pressure we are building it up to 60 for testing, and nothing is firing.

Just to be certain: Are you feeding the Solenoid Breakout’s power input with 24 volts?

Yes, we have a 20 amp fuse on it, should we be using a 30 amp?

Running it through a breaker would only give it 12 volts. 24 volts has to come from the power supply at the bottom of the PDB.


The cRIO only uses the first two terminals of the four on the 24v output of the Power Distribution Board. Use the second two to feed the Solenoid Breakout.

(The black connectors show a NC on the third terminal, but the PDB itself provides 24v there.)