Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Solenoid Breakouts? (http://www.chiefdelphi.com/forums/showthread.php?t=81502)

iTHOS=awesome 30-01-2010 13:10

Solenoid Breakouts?
 
Our electronics team has decided to use the solenoid (sp?) breakout on the cRio this year. My question is ... how do you define a solenoid (sp?) and control it in C++?

jhersh 31-01-2010 01:03

Re: Solenoid Breakouts?
 
Quote:

Originally Posted by iTHOS=awesome (Post 909907)
Our electronics team has decided to use the solenoid (sp?) breakout on the cRio this year. My question is ... how do you define a solenoid (sp?) and control it in C++?

You use the (big surprise... spoiler alert...) Solenoid class. Pass the channel (and optionally the module slot) to the constructor. Then call Set to set the value. Probably the simplest class in the library.

I'm guessing you posted this before looking at the library. Or did you have a specific question that you forgot to include?

KRibordy 03-02-2010 21:29

Re: Solenoid Breakouts?
 
I tried getting this to work today; I managed to get a green light on the solenoid breakout, but after defining the solenoid objects, using the Set() function did nothing.


Our code looks something like this.

Solenoid *solenoidOne;
Solenoid *solenoidTwo;

solenoidOne = new Solenoid(1);
solenoidTwo = new Solenoid(2);


Into operator code...

if(joystick->GetTrigger()) {
solenoidOne->Set(true);
solenoidTwo->Set(false);
}
else {
solenoidOne->Set(false);
solenoidTwo->Set(true);
}


I might be doing something completely wrong here. This our first year using pneumatics with the new control system, so I'm a bit confused. The code manages to get into the if statement, but the solenoid commands do nothing. Is there anything glaringly wrong that you can see?

ehochstein 03-02-2010 22:04

Re: Solenoid Breakouts?
 
We were having the same problem today on our robot, does your solenoid have little buttons you can press to release pressure also? If so try pressing them and if it works it means you have your solenoid wired correctly.

Alan Anderson 03-02-2010 22:52

Re: Solenoid Breakouts?
 
Quote:

Originally Posted by KRibordy (Post 912938)
...the solenoid commands do nothing.

Before we do any detailed debugging, did you remember to Enable the robot?

KRibordy 04-02-2010 19:49

Re: Solenoid Breakouts?
 
Yes. Everything else ran fine, (except for the stuttering caused by the watchdog glitch) including the jaguars and camera feed. We just plugged the solenoid breakout into the cRIO and then ran two wires from the solenoid breakout, one to each end of the solenoid assembly. Again, we haven't used the new system to control pneumatics, so I may be missing a critical step here.

Alan Anderson 04-02-2010 22:55

Re: Solenoid Breakouts?
 
Quote:

Originally Posted by KRibordy (Post 913554)
Yes. Everything else ran fine, (except for the stuttering caused by the watchdog glitch) including the jaguars and camera feed. We just plugged the solenoid breakout into the cRIO and then ran two wires from the solenoid breakout, one to each end of the solenoid assembly. Again, we haven't used the new system to control pneumatics, so I may be missing a critical step here.

Which slot did you plug the module into? The code expects it in slot 8 by default. Do you have the compressor working? Most solenoid valves won't do anything without air pressure. Have you observed whether or not the green lights on the cRIO digital output module are changing when you press the trigger?

KRibordy 05-02-2010 16:47

Re: Solenoid Breakouts?
 
I'm pretty sure we didn't have it in slot eight; we were running the compressor off an external battery, so that code wouldn't be the problem. Why would the cRIO digital output be affected? We're running the solenoids from the solenoid breakout, right?


EDIT: We hooked the solenoid breakout to the 9472 module in slot eight. We connected the two cables to either side of the solenoid and used the code above...but nothing worked.

The buttons on the solenoid do work for switching, but the trigger does not.

Alan Anderson 05-02-2010 22:32

Re: Solenoid Breakouts?
 
Quote:

Originally Posted by KRibordy (Post 914127)
I'm pretty sure we didn't have it in slot eight; we were running the compressor off an external battery, so that code wouldn't be the problem. Why would the cRIO digital output be affected? We're running the solenoids from the solenoid breakout, right?

The solenoid breakout had better be on the digital output module, or it won't do anything.

Quote:

EDIT: We hooked the solenoid breakout to the 9472 module in slot eight. We connected the two cables to either side of the solenoid and used the code above...but nothing worked.
You're providing power to the solenoid breakout, right? The voltage needs to match what the solenoid expects, either 12 or 24 volts, following the power diagram on the FIRST web site.

When you say "nothing worked", does that include no green lights on the output module?

KRibordy 09-02-2010 20:37

Re: Solenoid Breakouts?
 
We solved our problem; it turned out to be a multitude of different problems with our code. I changed the code from using "true" and "false" to using "0" and "1" and also moved the module to slot eight. By removing all of our code except the solenoid commands, we were able to get the solenoid to switch back and forth between the two outputs every few seconds. Thanks!

superstretch 20-02-2010 21:14

Re: Solenoid Breakouts?
 
shouldn't using true/false or 1/0 not make a difference?

KRibordy 21-02-2010 13:09

Re: Solenoid Breakouts?
 
That probably didn't; we changed a few things to make it work. But it works now, so I'm not worried.


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

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