Coding help for pneumatic wings

I’m trying to code some pneumatic wings with this code

if (Controller.ButtonL1.pressing())
LeftWing.set(true);
RightWing.set(true);

if (Controller.ButtonL2.pressing())
LeftWing.set(false);
RightWing.set(false);

for some reason it only moves the left wing des anyone know why?

Without context, this either be a hardware issue or you have a mistyped pneumatic in your code

I already checked and there are no spelling errors. How do you check for a hardware issue.

In c++, whenever you have a conditional statement, you need curly braces around the code to be executed if the condition is met if the code is longer than one line. Your first statement should become:

if (Controller.ButtonL1.pressing()){
LeftWing.set(true);
RightWing.set(true);
}

2 Likes

Try doing seperate things?

@Z-Axis I know you are a good coder, do you have any thoughts on this?

1 Like

When you turn your robot on, do the wings extend/retract? If not, it’s a programming issue and I can’t help you.

Here is some code we use that works fine. If this does not fix the issue I would try using a different solenoid.

vex::digital_out  LeftWing = vex::digital_out(Brain.ThreeWirePort.A);
vex::digital_out  RightWing = vex::digital_out(Brain.ThreeWirePort.B);

int main() {
    while (true) {
        if (Controller.ButtonL1.pressing()) {
            LeftWing.set(true);  // Open the solenoid
        } else {
            LeftWing.set(false);  // Close the solenoid

     if (Controller.ButtonL2.pressing()) { 
            RightWing.set(true); // Open the solenoid
        } else {
            RightWing.set(false);  // Close the solenoid
        }
    }
}

thank you very much for the help

my right wing does extend by itself. is there a way to stop this from extending by itself

reverse the ports on the air cylinder and that should cause it to stay put when you turn the robot on.

2 Likes