How Do I Code VEX V5 Text Pneumatics?

I’m new to pneumatics, and I don’t have any clue how to code them. All the “tutorials” are in block code, and I only use text. This is all I have so far:

"if (Controller1.ButtonR1.pressing())


When I hit play, it immediately fires. When I hit stop, it immediately releases. I use two single-action pistons, connected to a single-acting solenoid with a T-Intersection connecter. What do I do to the code to make it work?

1 Like

This is what my team uses and it works for us.

What you want to do is create a variable that can changes its number every time an input on the controller changes. Then, if then variable is set to a certain value, it knows to do a certain thing.


int piston = 1;
if (Controller1.ButtonR1.pressing() && piston == 1) {
piston = 2;
if (!Controller1.ButtonR1.pressing() && piston== 2)
piston = 3;
if (Controller1.ButtonR1.pressing() && piston == 3) {
piston = 4;
if (!Controller1.ButtonR1.pressing() && piston == 4)
piston = 1;

You would have to make a new variable and new code for a second piston.
Hope this helps!