Hello Vex Forums,
I have successfully coded my robot, but I am looking to improve on it. Right now we have a catapult bot where if you hold a button, the catapult goes down. However, I am looking to make it so that I can click the button once instead of having to hold it. We have a limit switch so we know when it will stop, I know of a shaft encoder, but we are not using it. Our current catapult bot code is:
//Catapult Code
if (Controller1.ButtonR2.pressing() and Lim.pressing() == false) {
Catapult.spin(directionType::fwd,100,velocityUnits::rpm);
}
if (Lim.pressing()){
Catapult.spin(directionType::fwd, 10, velocityUnits::rpm);
}
if (Controller1.ButtonR1.pressing() and Lim.pressing()){
Catapult.spin(directionType::fwd,100,velocityUnits::rpm);
}
I am wondering how to use the pressed command. When I replace the first lines pressing with:
if (Controller1.ButtonR2.pressed(){
Catapult.spin(directionType::fwd,100,velocityUnits::rpm);
}
It pops up with an error and doesn’t compile properly.
If anyone has a solution to the pressed function, please share on how to use it I am lost on this.
With Best Regards,
6722C