Go to Post I expect you to make mistakes and need help constantly. Just be sure each time you come to me, it's a new mistake and a different kind of help you need. This way I know you're growing. - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 18-02-2011, 23:45
JohnSchneider's Avatar
JohnSchneider JohnSchneider is offline
Registered User
FRC #3310 (Black Hawk Robotics)
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2010
Location: Dallas
Posts: 777
JohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond repute
Unhappy 24V FESTO Solenoid Code

I am trying to finish up some last minute code for our robot and am at a loss for the 24V solenoid provided in the KOP (At least last year). Its double acting and I grasp how it works, but I cant find any documentation on how to program that partiucular solenoid.

I grasp the concept of saying

Solenoid s1 = new Solenoid(8,1);
Solenoid s2 = new Solenoid(8,2);

to initialize the two halves of the double solenoid (with 4 pins plugged into the I/O board)

But how to set which one turns on in code is bewildering to me...as it doesnt appear to be as easy as

if (buttonPressed == true)
{
s1.Set(0);
s2.Set(1);
}

else
{
s1.Set(1);
s2.Set(0);
}

Any pointers on what I'm doing wrong?
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2011, 02:07
Matt Daioh's Avatar
Matt Daioh Matt Daioh is offline
Registered User
FRC #3501 (Grinders)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Sunnyvale
Posts: 10
Matt Daioh is an unknown quantity at this point
Re: 24V FESTO Solenoid Code

Hi John,
You have the right idea with the programming.

We had a method like this for activating pneumatics
Quote:

void ActivatePneumatics(Joystick *currStick, int buttonNum, int SolenoidNumberTurnOn, int SolenoidNumberTurnOff){
if(currStick->GetRawButton(buttonNum)){
m_solenoids[SolenoidNumberTurnOff]->Set(false);
m_solenoids[SolenoidNumberTurnOn]->Set(true);
When one action happens, turn on set of solenoids on and another off.
When we wanted to activate something using this method we structured it like this
Quote:

ActivatePneumatics(m_rightStick, BUTTON_MINIBOT_OUT, SOLENOID_MINIBOT_OUT, SOLENOID_MINIBOT_IN);
Also, we established variables that represented the various buttons we would press in order to do turn on the various solenoids. You should design something like this that fits your needs


Quote:

static const int SOLENOID_MINIBOT_OUT = 1;
static const int SOLENOID_MINIBOT_IN = 2;
static const int SOLENOID_CLAW_OPEN = 7;
static const int SOLENOID_CLAW_CLOSE = 8;

static const int BUTTON_MINIBOT_OUT = 6;
static const int BUTTON_MINIBOT_IN = 7;
static const int BUTTON_CLAW_OPEN = 1;
static const int BUTTON_CLAW_CLOSE = 2;

static const int NUM_SOLENOIDS = 8;
Solenoid *m_solenoids[(NUM_SOLENOIDS+1)];

I hope that helps. Do you have any more questions?
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2011, 09:47
JohnSchneider's Avatar
JohnSchneider JohnSchneider is offline
Registered User
FRC #3310 (Black Hawk Robotics)
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2010
Location: Dallas
Posts: 777
JohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond reputeJohnSchneider has a reputation beyond repute
Re: 24V FESTO Solenoid Code

So on the 24V double solenoid valve it's as easy as "true false"? I thought that there were Stations for it like "set_forward" or something similar.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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