Chief Delphi

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

Rikard023 24-02-2010 09:49

need Solenoid help
 
If anyone knows how to write a solenoid program correctly or any where i can get info on it, I would be very Grateful

slavik262 24-02-2010 10:06

Re: need Solenoid help
 
Have you looked at the documentation? It should give you a good start.

Rikard023 24-02-2010 11:05

Re: need Solenoid help
 
Yea i looked at it and wrote from it and it didn't work

mikets 24-02-2010 13:05

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


mikets 24-02-2010 13:13

Re: need Solenoid help
 
Forgot to mention a few more things: make sure your DO module is in the default slot 8 (or you have to specify the slot in the code). Also make sure the soloenoid bumper is powered with appropriate voltage. FIRST provided 24V valves this year, so you need to feed 24V to the bumper (not 12V).

mikets 24-02-2010 13:35

Re: need Solenoid help
 
BTW, forgot to mention one more thing: you need to create a compressor object too. The compressor power should be hooked to a Spike relay and the pressure switch should be hooked to a digital input channel.
Code:

#define PRESSURE_SWITCH_CHANNEL  1
#define RELAY_COMPRESSOR_POWER  1
private:
Compression *m_compressor;
...

// In some constructor
    m_compressor = new Compressor(PRESSURE_SWITCH_CHANNEL, RELAY_COMPRESSOR_POWER);
    m_compressor->Start();


Rikard023 24-02-2010 14:20

Re: need Solenoid help
 
thanks that should be egood enough


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

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