PROS pneumatics not controlled

Hi,

I’m working on pneumatics for my robot, but the code doesn’t seem to control the pneumatics (or does strangely). When the code runs, the pneumatic immediately extends (it should be retracted in the code) and isn’t controlled by the actual code, and then retracts/releases once the code stops. I managed to simplify it to the following minimum reproducable example, is there something I’m doing wrong in trying to control the pneumatics? (The pneumatics should be in analog port A)

void initialize() {
pros::ADIDigitalOut pneumatics ('A');
}

void opcontrol() { // Should retract, extend, retract, extend, and retract the pneumatic, 1 second each time
    pros::ADIDigitalOut pneumatics ('A');
    pneumatics.set_value(false);
    pros::delay(1000);
    pneumatics.set_value(true);
    pros::delay(1000);
    pneumatics.set_value(false);
    pros::delay(1000);
    pneumatics.set_value(true);
    pros::delay(1000);
    pneumatics.set_value(false);
}
1 Like

When you declare your pneumatics, you can also set a default state of the pneumatics bool init_state
By default, this value is set to false

Try setting it to true
ADI (TriPort) C++ API — PROS for V5 3.8.0 documentation (purdue.edu)

1 Like

Another thing that controls the start state of a pneumatic are the tubes that are connected to the solenoid and pneumatic. Try switching those around (this should only be a problem for double-acting pneumatics, so I am going to assume you are using one). I believe this should fix your problem. The solution proposed by Jouza should also fix your problem, though.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.