View Single Post
  #2   Spotlight this post!  
Unread 02-19-2011, 02:07 AM
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