Quote:
Originally Posted by Nguyen
I'm helping out a team with no programming experience and I have basic experience but none relating to FIRST.
They are trying to code their pneumatics but don't know how to do so or even where to start.
The basic setup is as follows:
there are 3 pneumatic valves:
the first one is connected as follows: festo valve -> spike relay -> pwm8
the second is festo valve -> spike relay -> pwm12
the third is festo valve -> spike relay -> pwm16
the compressive is compressor-> spike-> relay8
the 3 valves would be independently controlled by 3 arbitrary joystick buttons
Would anyone be so kind as to point me in the right direction?
|
ok, so first of all spike relays cannot be plugged into pwm outputs. What they do need to be plugged into are the relay outputs.
ok now that you have all the pneumatics plugged into relays and not pwms, ill go over how they work. The relays are basically 2 digital outputs slapped into a single cable, so there are two bits that you can set. relay#_fwd and relay#_rev. What this gets translated into is either +12V, -12V, 0V to the festo Valves. So in order to set them to one direction you would use this line of code
relay#_fwd = 1;
relay#_rev = 0;
this will set your festo valve to actuate your pneumatic one way and if you switch which bit is set to 1 then you actuate the pneumatic the other way. Now is for some reason you dont want any pressure in the cylinders then you set each bit to 0.
Now if you want to change these based on a button on a joystick then you can change the relay#_fwd and relay#_rev bits inside an if statment such as
if(p1_sw_top ==1)
{
relay#_fwd = 1;
relay#_rev = 0;
}
If you need any help any further feel free to pm me and I'll try to help you.