How do I use and code pneumatics?

I’ve known about teams who have used pneumatics in their robot to help them conserve motors and gain more abilities, but I’ve always wondered how they got the pneumatics to work. What are all the components of pneumatics and how do they each work? And how would you code them in vex code v5? For example, what components would you need to make an indexer for spin up and how would you code that?

Look in the V5 knowledge base library:

specifically under the “Mechanical” tab.

2 Likes

Try this from the Vex library. Controlling Pneumatics Using Buttons on Your Controller – VEX Library It should provide all the answers you need.

I don’t know much, but all I can say personally is that Single-Action pneumatics can be put in as LEDs under the 3-wire option in the “add device” menu.
Also, “off” releases air/does an activity, and “on” prevents it. Keep that in mind so that you don’t reverse it and accidentally release all your air/do something early right at the start of the match.

For all the components and how to get them to work, the best resource is probably this article. To control them, you attach the solenoid to a legacy port on the brain using the vex driver cables.

This is how you would code pneumatics in Vexcode V5:
First, make sure to create a 3 wire DigitalOut device (I use port a, you can use any port)

Setting the digitalout device to true extends the piston, and turning it to false retracts it.

C++:

int main() {
    // turns cylinder on for one second
    DigitalOutA.set(true)
    wait(1, seconds);
    DigitalOutA.set(false)
}

Python:

# Turns pneumatic on for one second
digital_out_a.set(True)
wait(1, SECONDS)
digital_out_a.set(False)

This article describes how to do it with blocks

For making a indexer, look at some examples. You could do something like this that indexes it linearly:
image

I’ve also seen teams that do something like this, but it would be a little bit more difficult to implement:

3 Likes

Theres many ways to do it, if the pneumatics are for an indexer i recommend coding it to where its only extended if the button is being held. You do this with a digital out. There is only one command for a digital output:
“.set(true/false)”
Screenshot 2023-01-18 160717

1 Like