Need help with macros

I need help coding my macros for my robot. I have the code for the buttons regularly, but the brake type is on hold. Is this supposed to interfere?
this is the code for the macro
outside of usercontrol
void methodA() {

LIMotor.startRotateFor(directionType::rev, .2, rotationUnits::rev, 100, velocityUnits::pct);
RIMotor.rotateFor(directionType::rev, .2, rotationUnits::rev, 100, velocityUnits::pct);
}
in the user control
//set intakes down something rotations
(Controller1.ButtonA.pressed(methodA));

your void command is good. But I do macro a bit different. Not sure what this is what your looking for but this is what it would be

void methodA() {

LIMotor.startRotateFor(directionType::rev, .2, rotationUnits::rev, 100, velocityUnits::pct);
RIMotor.rotateFor(directionType::rev, .2, rotationUnits::rev, 100, velocityUnits::pct);

}
//in the user control

if (Controller1.ButtonA.pressing()) {

methodA()

};
1 Like

Thanks!
Ill try it when I get a chance, but I want to just press a button, and then the intakes to move a certain distance.

A-team, if you need to do only one action then it is best to do what @Micah_7157X said using rotateFor() function.

https://api.vexcode.cloud/v5/html/classvex_1_1motor.html#a9d60dc336810ea4d8aef35ee042f0d68

Or, if you need multiple steps, please, take a look at these macro programming examples:

Thanks, I figured I probably needed to do something like that, creating a state value. I’m good now