PROS Pneumatics coding issues

We have recently been trying to program our pneumatic cylinders in PROS. We got them working using the manual valve on the solenoid, but have not got the pneumatics working using a controller button. Here is our code:

bool isPressed = MasterController.get_digital_new_press(E_CONTROLLER_DIGITAL_A);

if(isPressed && pneumatic_value%2 == 0){
pneumatic_lift.set_value(true);
screen.print(TEXT_LARGE, 1, '0');
pneumatic_value++;
}

else if(isPressed && pneumatic_value%2 == 1){
pneumatic_lift.set_value(false);
screen.print(TEXT_LARGE, 1, '1');
pneumatic_value++;
}

This code runs in a while loop inside a task. We know that the if statements work because every time we press the correct button, the text on the brain changes from 0 to 1 or from 1 to 0. However, the pneumatic cylinder never changes its state. We tried manually calling pneumatic_lift.set_value() in opcontrol, but it still did not change the default state of the cylinder. Even the PROS tutorial found at the PROS documentation did not work at all. What should we do?

I’m confused, you never set_value the solenoid to anything other than true. What is the behavior that you are expecting from this code?

1 Like

Sorry, that should be false. It was false in the code. I typed this out because I did not have access to the original code. I will edit the original post.

My team just figured out that this was a build issue. That is why we were confused, because the code didn’t have any flaws. Thanks for checking anyway.

1 Like