Pneumatic code help

Good afternoon,
My team is only a year old and we are just experimenting using pneumatics. This year our bot has the “wings” prominent with many bots this season. I tested our pneumatic system today by pressing the buttons on the cylinder’s solenoid, and it worked great. Then, whenever I try to use the program, where I coded the cylinders to a button, it doesn’t move at all. I attached photos of the layout if it helps, as well as the code. I listed the cylinder as a 3 Wire- Digital Out in the device section.
IMG_6470


Thanks!
15800A
Altoid Artillery

Your “If” statement will only run once, and very quickly, put it inside a forever loop.

2 Likes

Just for fun, I asked ChatGPT

I need help controlling my vex pneumatics

Certainly! Controlling VEX pneumatics involves using a pneumatic system to manipulate various components in your robot. Here are some general steps and tips for controlling VEX pneumatics:

  1. Install the Pneumatic System:

    • Make sure you have properly installed the pneumatic components, including the pneumatic cylinders, solenoids, tubing, and pressure regulator, following the VEX pneumatics kit instructions.
  2. Connect the Pneumatics to the Brain:

    • Connect the pneumatic components to the VEX brain. The solenoids, which control the airflow to the cylinders, are typically connected to the VEX digital ports.
  3. Use the VEXcode Programming Software:

    • VEX provides programming software called VEXcode, which allows you to program your robot’s behavior, including the control of pneumatics. Write your code using VEXcode, which supports both block-based and text-based programming.
  4. Programming Solenoids:

    • In your code, you’ll need to control the solenoids to manage the airflow to the pneumatic cylinders. Typically, you’ll use functions or commands to open and close the solenoids. For example, you might use a command like startMotor(port) to open the solenoid and stopMotor(port) to close it.
    // Example code to control a solenoid
    vex::controller Controller = vex::controller();
    vex::digital_out Solenoid = vex::digital_out(Brain.ThreeWirePort.A);
    
    int main() {
        while (true) {
            if (Controller.ButtonA.pressing()) {
                Solenoid.set(true);  // Open the solenoid
            } else {
                Solenoid.set(false);  // Close the solenoid
            }
        }
    }
    
  5. Handling Multiple Solenoids:

    • If you have multiple solenoids, you may need to control them independently. Each solenoid should be connected to a different digital port, and your code should manage the state of each solenoid separately.
  6. Pressure Regulation:

    • Be mindful of pressure regulation to prevent damage to the pneumatic components. Use the pressure regulator included in the VEX pneumatics kit to set and maintain a safe pressure level.
  7. Test and Debug:

    • Test your code in a controlled environment and debug any issues that arise. Make sure the pneumatic components are working as expected and that the code behaves as intended.

Remember to refer to the official VEX documentation, including the VEXcode API documentation, for detailed information on programming VEX pneumatics with the specific hardware and software you are using.

wish I was 40 years younger, this is going to be so cool.

6 Likes