Solenoid Breakout

wiring of the solenoid valves is proper, i do not know if the breakout is using 24 volt power as opposed to 12, however, when defining the Solenoids as such:

Sol1 = new Solenoid(1);

should the word Solenoid(after new) be recognized and highlighted or does it remain unlighted. as well as, why would windriver not recognize the joystick command for GetRawButton. It recognizes everything but GetRawButton, therefore, it does not work i must use GetTrigger or GetTop.

Ex. if(rightStick.GetRawButton(4))
{Sol1 -> Set(true);}

I have found Wind River is a little buggy when it comes to some of the functions for highlighting. As long as the code compiles it is fine

How did you declare and instantiate rightStick? If you dynamically instantiate it such as:

Joystick *rightStick = new Joystick(n);

Then you should be doing:

if (rightStick->GetRawButton(4))

I declared it as

rightStick(1, 3, 11),
leftStick(2, 3, 11),

also is this stated properly for victors?

if …

What is with the 2,3,11?

I’ve always just used (1),(2),(3), etc and it has worked fine.

And you cant JUST say rightStick(1). It needs to be declared as a joystick somewhere.


#include "WPILib.h"

class Aweseome1610Robot: public SimpleRobot
	RobotDrive myRobot; // robot drive system
	Joystick leftStick; 
        Joystick rightStick;
        Victor victorOfDoom;

		: myRobot(1, 2)	// left side, right side
		, leftStick(1)
	        , rightStick(2)
                , victorOfDoom(5) //Victor of Doom is on PWM slot 5

	void RobotMain(void)
		while (true) //Bad practice, dont do that. :P

                   if(rightStick.GetRawButton(1) //Trigger
/*Drive the Victor based on the leftSticks throttle, because the Set function accepts a Float value, and GetThrottle returns a float. */



You are declaring the joysticks as having 3 axes and 11 buttons and on port 1 and 2 respectively. That looks fine. I checked the wpi library source code and it should work. There must be something else in your code that is interfering. My experience with robot programming is that you can stare at a segment of code and it looks perfectly fine but it is other part of the code that was the problem. For example:

if (rightStick.GetRawButton(4))
// A long way down the code if you have:
Sol1->Set(false); // This will negate what you were trying to do.

In the past, we had code to run the motors but the motors were not running. We even put some print statement in the code to make sure the code to turn the motor on was executed but the motors were still not running. It turns out some function call soon after was turning off the motors immediately. This is just to demonstrate when you have a problem that doesn’t make sense, look wider.