How to configure pneumatics in VEXcode Pro V5

Hi,

Can anyone provide example code for configuring pneumatics? I’ve tried everything I can find online, but I still end up with a memory permission error each time.

Thanks!

Pneumatics are configured as “digital out” devices:

https://kb.vex.com/hc/en-us/articles/4402846880788-Using-3-Wire-Digital-In-Digital-Out-Devices


“Memory permission error” strikes me as an unusual kind of error to get in this scenario – what are you doing to configure the pneumatics right now?

5 Likes

This is how I have it configured now.

digital_out dig1 = digital_out(Brain.ThreeWirePort.H);

That line looks OK – could you share the complete contents of your main.cpp? Maybe the problem is somewhere else.

Please include triple backtics (```) before and after your code, on their own line, for formatting.

1 Like

We have a separate file for testing pneumatics right now because I wanted to make sure that the problem was actually caused by the pneumatics. This is the whole thing right now.

#include "vex.h"

using namespace vex;

digital_out dig1 = digital_out(Brain.ThreeWirePort.H);

vex::controller master(vex::controllerType::primary);

int main() {
    while (1) {
        if (master.ButtonL1.pressing()) {
            dig1.set(true);
        } else {
            dig1.set(false);
        }
    }
}

Just to check – are you sure the solenoid is actually connected to port H?

You are probably using Brain.ThreeWirePort.H before it’s been instantiated, all depends on the name of the file, there’s no guarantee for order of constructors across files. There’s one way to deal with that here.

4 Likes

Hi, I added this line of code above where I configured dig1, but I am still getting an error.

triport ThreeWirePort = vex::triport( vex::PORT22 );
digital_out dig1 = digital_out(Brain.ThreeWirePort.A);

We got it!!! Thanks for your help everyone.

1 Like