Mechanum wheel code

ok

/*----------------------------------------------------------------------------*/
/*                                                                            */
/*    Module:       main.cpp                                                  */
/*    Author:       C:\Users\Yoga260                                          */
/*    Created:      Mon May 11 2020                                           */
/*    Description:  V5 project                                                */
/*                                                                            */
/*----------------------------------------------------------------------------*/

// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name]               [Type]        [Port(s)]
// Controller1          controller                    
// frontR               motor         1               
// backR                motor         10              
// frontL               motor         11              
// backL                motor         20              
// ---- END VEXCODE CONFIGURED DEVICES ----

#include "vex.h"
#include "robot-config.h"

using namespace vex;

int main() {
  // initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();
  


;



backR.spin(vex::directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis1.value() + Controller1.Axis4.value(),  vex::velocityUnits::pct);
frontL.spin(vex::directionType::fwd, Controller1.Axis3.value() - Controller1.Axis1.value() - Controller1.Axis4.value(), vex::velocityUnits::pct);
backL.spin(vex::directionType::fwd, Controller1.Axis3.value() + Controller1.Axis1.value() - Controller1.Axis4.value(), vex::velocityUnits::pct);
frontR.spin(vex::directionType::fwd, Controller1.Axis3.value() - Controller1.Axis1.value() + Controller1.Axis4.value(), vex::velocityUnits::pct);



}



 ///Place these two lines of code above the while(1){       This is at the bottom of the code

///Place the two lines that are below under the //Set up callbacks for autonomous and driver control periods. that is on the bottom of the code.

// 

also thank you for telling me that i didn’t know you could do that

yah sure thing. By the way the reason its not working is because it is not in a while loop. And is that your whole code? our just the part that you highlighted

that is the whole main.cpp code. I will try the while loop now.

Yah that would make sense why that doesn’t work

would i just put the loop before and after the code for the wheels or before the vexcodeInit();

I would say before that you should make a competition template. Because you wouldn’t be able to use it at a comp if you don’t do that. Do you know how to do that

my dad told me were to find it

Does you dad have knowledge about all this stuff.

he has some but is learning as much as me. i have to go for about an hour but i will try as soon as i get back and tell you what happens.

K. I am by the way making a competition template and going to set up a code for you. Nothing crazy. it is just for the drive. If you are going to do more than just drive a chassis there will be a more that will have to be done.

If you rather do it on your own that is also great.

i am back and i can make one if that dose not work i will let you know

it is now telling me this

 backR.spin(vex::directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis1.value() + Controller1.Axis4.value(),  vex::velocityUnits::pct);
  frontL.spin(vex::directionType::fwd, Controller1.Axis3.value() - Controller1.Axis1.value() - Controller1.Axis4.value(), vex::velocityUnits::pct);
  backL.spin(vex::directionType::fwd, Controller1.Axis3.value() + Controller1.Axis1.value() - Controller1.Axis4.value(), vex::velocityUnits::pct);
  frontR.spin(vex::directionType::fwd, Controller1.Axis3.value() - Controller1.Axis1.value() + Controller1.Axis4.value(), vex::velocityUnits::pct);
  }

the first lines ; says “expected )”

You need parentheses on both sides of your expression, not just one at the front.

2 Likes

I don’t know what you mean by this. Are you saying there is an error. By is that in competition template

Would you like me to copy and paste the competition template with the drive code I wrote. If you see it I think you will understand this more. You don’t have to copy and paste it is just to look at

that would be helpful thank you

Literally just put parentheses on either side of your expression and it’ll work.

1 Like

there is one after the spin and one before the ;