View Single Post
  #4   Spotlight this post!  
Unread 24-02-2010, 13:05
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: need Solenoid help

Are you doing pneumatics? If so, there are a number of ways to wire pneumatics. Assuming you hook the pneumatic valve to two Solenoid channels (DO channels). Here is the code to operate it.

Disclaimer: I am new to pneumatics, so this may not be the right way to do it, but it works for us. Another way to do it is to use a relay instead of two solenoid channels but it requires a relay.

Code:
#define SOLENOID_EXTEND_CHANNEL  1
#define SOLENOID_RETRACT_CHANNEL 2
private:
    Solenoid *m_solenoidExtend;
    Solenoid *m_solenoidRetract;
...

// In some constructor
    m_solenoidExtend = new Solenoid(SOLENOID_EXTEND_CHANNEL);
    m_solenoidRetract = new Solenoid(SOLENOID_RETRACT_CHANNEL);

...

// To extend the pneumatics
    m_solenoidRetract->Set(false);
    m_solenoidExtend->Set(true);

// To retract the pneumatics
    m_solenoidExtend->Set(false);
    m_solenoidRetract->Set(true);
Reply With Quote