Hello, I wonder if I could pass vex data types as functions.
Example:
void buttonTask(short buttonName1, short buttonName2, short motorName, int offset=0) {
if (Controller1.buttonName1.pressing())
{
motorName.spin(directionType::fwd, 200-offset, velocityUnits::rpm);
}
}
You could pass controller.buttonname by reference.
void buttonTask ( vex::controller::button &button1 ) {
if(button1.pressing()){
//code
}
}
2 Likes