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!
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:
“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?
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.
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.
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.
MIke, could you share a screen shot of the code that finally worked for you? We’re following in your footsteps through this process and would really appreciate any help. We are just getting started.
This code with Brain.ThreeWirePort.A
replaced with ThreeWirePort.A
should work