nothing else to do.
pneumatics driver should be plugged into port H on the V5 brain.
Are you using VCS or VEXcode ?
VEX C++ Programming Pneumatics
What is vcs is that required? And how is it different from vex code
VCS = VEX coding studio, programming IDE for the VEX V5 system.
VEXcode, a new text only programming environment for the VEX V5 system.
This topic was discussing programming pneumatics on the V5 using Vex coding studio, so I assume that’s what you are using.
Hello I have a question, so Is this for vex c++ or c++ pro?
It will function the same regardless
Hello sorry for bothering u but how will the pneumatic retract
If you can add some code please do just as an example
In the code from jpearman the L1 button extends and letting go of the button retracts it. (Or vice versa - you’ll have to test it)
void usercontrol( void ) {
//
int LiftLSpeedPCT = 100;
int LiftRSpeedPCT = 100;
while (1){
//tank controls
BackR.spin(directionType::fwd, (Controller1.Axis2.value()), vex::velocityUnits::pct);
BackL.spin(directionType::fwd, (Controller1.Axis3.value()), vex::velocityUnits::pct);
FrontL.spin(directionType::fwd, (Controller1.Axis3.value()), vex::velocityUnits::pct);
FrontR.spin(directionType::fwd, (Controller1.Axis2.value()), vex::velocityUnits::pct);
digital_out dig1 = digital_out( Brain.ThreeWirePort.Port[7] );
while(1) {
if( Controller1.ButtonR1.pressing() ) {
dig1.set( true );
}
else {
dig1.set( false );
}
this_thread::sleep_for(10);
}
}
//lIFT Control
if(Controller1.ButtonL1.pressing()) {
LiftL.spin(vex::directionType::fwd, LiftLSpeedPCT, vex::velocityUnits::pct);
LiftR.spin(vex::directionType::rev, LiftRSpeedPCT, vex::velocityUnits::pct);
}
else if(Controller1.ButtonL2.pressing()) {
LiftL.spin(vex::directionType::rev, LiftLSpeedPCT, vex::velocityUnits::pct);
LiftR.spin(vex::directionType::fwd, LiftRSpeedPCT, vex::velocityUnits::pct);
}
else {
LiftL.stop(vex::brakeType::coast);
LiftR.stop(vex::brakeType::coast);
}
vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources.
}
this is my code and its not letting me control the bot whats wroooong
This right here is an infinite loop. the rest of your code is not executing. It’s already in a while loop, so you shouldn’t need another one for this if statement.
Additionally, your ‘LIFT CONTROL’ is outside the scope of your larger, still infinite, while loop. That code also needs to be in the loop to run
void usercontrol( void ) {
//
int LiftLSpeedPCT = 100;
int LiftRSpeedPCT = 100;
while (1){
//tank controls
BackR.spin(directionType::fwd, (Controller1.Axis2.value()), vex::velocityUnits::pct);
BackL.spin(directionType::fwd, (Controller1.Axis3.value()), vex::velocityUnits::pct);
FrontL.spin(directionType::fwd, (Controller1.Axis3.value()), vex::velocityUnits::pct);
FrontR.spin(directionType::fwd, (Controller1.Axis2.value()), vex::velocityUnits::pct);
digital_out dig1 = digital_out( Brain.ThreeWirePort.Port[7] );
if( Controller1.ButtonR1.pressing() ) {
dig1.set( true );
}
else {
dig1.set( false );
}
this_thread::sleep_for(10);
if(Controller1.ButtonL1.pressing()) {
LiftL.spin(vex::directionType::fwd, LiftLSpeedPCT, vex::velocityUnits::pct);
LiftR.spin(vex::directionType::rev, LiftRSpeedPCT, vex::velocityUnits::pct);
}
else if(Controller1.ButtonL2.pressing()) {
LiftL.spin(vex::directionType::rev, LiftLSpeedPCT, vex::velocityUnits::pct);
LiftR.spin(vex::directionType::fwd, LiftRSpeedPCT, vex::velocityUnits::pct);
}
else {
LiftL.stop(vex::brakeType::coast);
LiftR.stop(vex::brakeType::coast);
}
vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources.
}
}
last question would this work is there any problem, i cant test on my bot till next week thats why im asking
I don’t see any issues with it
The same way as before, but with time and placement instead of button presses. Below is how I’d turn it on for 1.5 seconds and then turn it off.
dig1.set( true );
Task::sleep(1500);
dig1.set( false );
it dont work man it says unclear use of “dig1”
Did you define dig1?
how? im sorry i just started coding
please include an example
nevermind bro i figured it out but thanks XD