Easy C Code for single vs double acting cylinders

Hey all,
I have a code that I used last year with a single acting pneumatic cylinder which worked great and is:
#include “Main.h”

void OperatorControl ( unsigned long ulTime )
int ClawOpenButton;
int ClawClosedButton;

  while ( 1 )
        ClawOpenButton = GetJoystickDigital ( 1 , 5 , 1 ) ;
        ClawClosedButton = GetJoystickDigital ( 1 , 5 , 2 ) ;
        if ( ClawOpenButton == 1 )
              SetDigitalOutput ( 4 , 1 ) ;
              SetDigitalOutput ( 5 , 1 ) ;
        if ( ClawClosedButton == 1 )
              SetDigitalOutput ( 4 , 0 ) ;
              SetDigitalOutput ( 5 , 0 ) ;


Unfortunately, when I try using this with a double acting cylinder, the outstroke is strong whilthe the instroke is practically nonexistent. I figured this was a programming flaw. Anyone able to help? Thanks

The issue is actually probably with the pneumatics themselves. The programming will work just fine with either single or double-acting pistons; the issue you are having is with the connectors going into the cylinder. The kit comes with two kinds of connectors to screw into the cylinder - one simple one that comes straight out of the hole it screws into, and another plastic-shelled one that connects to the tubing at a right angle to where it screws in. There is a little hole in the top of this right-angled one; that allows you to turn a valve inside the fitting that controls how much air goes through. This is handy if you want one stroke to take less air than the other or go slower for whatever reason, but I assume that it is a problem for whatever you are doing. What you want to do is put the direct connectors in both holes, or unscrew the valve with a flathead screwdriver until air goes through more easily.

Thanks, this helped a lot. This brought up a few other issues we are now trying to troubleshoot. One, when we pump up our storage tanks air seems to leak through the two “R” holes on the back of the double acting solenoid. I somewhat fixed it by pluggin these two holes with my fingers until the pressure reached about 60 psi on our bike pump, and then interestingly enough my fingers werent needed any more (they stopped letting out air at this point) and we continued pumping to 100 psi. Is there a better fix for this than the “finger method”?

Second question, does vex sell pneumatics tubing connectors? Im in need of a tube longer than 5 ft and not sure how to connect multiple tubes together aside from using the solenoids and pressure regulators.

Did you know that you’re allowed to use tubing longer than 5 feet? I don’t think Vex sells it, but you are allowed to buy identical tubing elsewhere.

The official word is here: https://vexforum.com/t/answered-usage-of-pneumatic-tubing-longer-than-5ft/26941/1

At least one place to buy it is mentioned in here: https://vexforum.com/showthread.php?p=368258

Hey all,
Having a new issue. While the code that I wrote above does seem to work for activating my double acting cylinder (and the flathead screwdriver idea did work for increasing stroke speed), when I placed this code under the rest of my operator control program (holonomic drive-4 motors and lift-6 digital motors) the program for those 10 motors doesn’t function. There are no issues with the cortex and controller not connecting (getting green lights all the way on both) or with the pneumatics, but there is absolutely no sign that my other 10 motors are functioning. I’m not sure what’s wrong here. When I tried removing the while loop that contains the pneumatics code, the 10 motors resume proper function. any ideas? Please and thank you

I’m not familiar with EasyC, but it sounds like your pneumatics might not have any way to kick out of the While loop they are placed in, so your code might not ever get out of the pneumatics loop and start reading the rest of your code. Is that possible?

I actually figured it out by setting up a whole secondary pneumatics system and testing my code, which did appear to work. I procceeded to check one by one all of the components on my bot and isolated the issue to a misconnected extension wire inside the sheathing that was protecting the wires and pneumatic tubing

Thanks for getting back and sharing what you learned. Very often teams figure out a problem but never let everyone else know how they went about solving it. :slight_smile: