Macros for v5

Hi all! I am planning on making macros for v5, and I dont know how to do it. Is it simply a if loop then if pressed run a spin command? Any help would be appreciated. Thanks!

This is for PROS btw

Would PROS work for vexcode v5 text?

You are correct, macros are typically just a loop checking for a button press.

We have all of our functions on macros
Low Tower
High Tower
Robot Reset

Just make a void function definition at the start of main.cpp or make a new file functions.h and include it at the start of main.cpp

Here’s an example

int tillerScore = 200;

void trayscore(){
Tiller.setVelocity(40, percent) 
Tiller.spinToPosition(tillerScore, degrees);

This is confusing to me. Could you post another or explain?

So at the start of your code after you include all the required files, you can int trayScore trayScore is the number in degrees that the motor will move to.

Next you use void nameOfFunction(){ to initialize the task. Now within the brackets set the motor’s velocity using. Motor.setVelocity(40, percent) .

Next move the motor to the designated position Motor.spinToPosition(trayScore, degrees);

Next set the break on the motor to hold to set the break on the the motor to hold it in that position Motor.setBreak(breakType::hold);

Lastly close the brace using }

Hope that helped