Programming Pneumatics with VEXcode 1.0.1

I need some help with programming pneumatics. I am trying to write a program that uses buttons on the screen to control pneumatics. However, I can’t actually get the buttons to control the pneumatics.
Thanks for the help,
Zachary

Here’s some sample code

while(true){
//If button up pressed, activate
if( Controller1.ButtonUp.pressing() ) {
piston.set( true );
}
//Otherwise don’t activate
else {
piston.set( false );
}
wait(20,msec)
}

1 Like

This thread might help you out:

1 Like

He needs to use the screen to control it not the controller

Ah I see.

while(true){
if (Brain.Screen.pressing()) {
piston.set( true );
} else {
piston.set(false);
}
}
This would work only if you are ok with pressing anywhere on the brain to activate the piston.

1 Like

I don’t know the exact code, but I have a program somewhere that has a button thing for custom sized buttons on the screen that I could dissect if you want

Yup, that would work. Eno can likely help you out if you only want a digital button trigger so you can use the rest of the screen for something else.

For now, just pressing the screen will work, but I would like to know how to make it work with custom-sized buttons in case I may need to use it in the future. Also, with the code that @thorstenl312 posted, what would I need to set up in robot config?

You would only need to initialize the brain and digital out
brain Brain;
digital_out piston = digital_out( Brain.ThreeWirePort.A );

2 Likes