Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Double solenoid code (http://www.chiefdelphi.com/forums/showthread.php?t=126203)

Zach S. 10-02-2014 18:09

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

Alan Anderson 10-02-2014 21:43

Re: Double solenoid code
 
http://wpilib.screenstepslive.com/s/...ders-solenoids 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.

Zach S. 11-02-2014 12:36

Re: Double solenoid code
 
My line of code for Set() looks like this
Code:

festo.Set(kForward);
festo is the call for our DoubleSolenoid. When i try to build the code I get the following errors:
Code:

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?

RufflesRidge 11-02-2014 12:42

Re: Double solenoid code
 
Quote:

Originally Posted by Zach S. (Post 1341228)
Any idea why the Set() I am using is not working?

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

Zach S. 11-02-2014 13:30

Re: Double solenoid code
 
Quote:

Originally Posted by RufflesRidge (Post 1341231)
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?

RufflesRidge 11-02-2014 13:47

Re: Double solenoid code
 
Quote:

Originally Posted by Zach S. (Post 1341258)
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.

Zach S. 11-02-2014 13:48

Re: Double solenoid code
 
Quote:

Originally Posted by RufflesRidge (Post 1341267)
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!

Zach S. 17-02-2014 14:07

Re: Double solenoid code
 
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?

Alan Anderson 17-02-2014 14:25

Re: Double solenoid code
 
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?

Zach S. 17-02-2014 16:41

Re: Double solenoid code
 
Quote:

Originally Posted by Alan Anderson (Post 1344590)
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.

Alan Anderson 17-02-2014 21:52

Re: Double solenoid code
 
Quote:

Originally Posted by Zach S. (Post 1344688)
24 Volt, I have the wires running from the solenoid breakout board into the FESTO.

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

Zach S. 18-02-2014 09:48

Re: Double solenoid code
 
Quote:

Originally Posted by Alan Anderson (Post 1344945)
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?

cgmv123 18-02-2014 09:59

Quote:

Originally Posted by Zach S. (Post 1345135)
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.

Alan Anderson 18-02-2014 10:30

Re: Double solenoid code
 
Quote:

Originally Posted by cgmv123 (Post 1345149)
24 volts has to come from the power supply at the bottom of the PDB.

Right.

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.)


All times are GMT -5. The time now is 12:12.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi