Is this code correct? Can someone give me a sample code for using the controls?

Backleftmotor,spin(directionType::fwd,50,velocityunits::pct);
Backrightmotor,spin(directionType::fwd,50,velocityunits::pct);

task::sleep(3000);

Backleftmotor.stop();
Backrightmotor.stop();

Are you just trying to make the motors go forward at 50% for 3 seconds? You’re using VCS right?

Periods, not commas between object names and their methods: .spin instead of ,spin twice.

Yeah I am just trying this code to get used to the formatting and all that. I am using VCS. Thankyou for you help. Can someone give me a sample code to use for the joystick?

First make sure you’ve included a controller. Drag is over in Robot. (I’m pretty sure you’re in VEX C++, not C++ Pro.) Change the two 50s to

Controller1.Axis3.value() // for the left side and
Controller1.Axis2.value() // for the right side

Also, make sure this is wrapped in something that repeats, most commonly while(true){} so that the controller’s axis values are repeatedly checked. That will give you a tank drive

There is also sample code in VEX Coding Studio. When you start the program, click on Example Code at the top and there are a bunch to choose from.

You can also go to:

vex coding studio learning start and stuff

that’s where I started learning

edit: the link itself is:
https://help.vex.com/collection/122-vex-coding-studio

Ok thanks,
We have this code and we have named all of our motors

int howMany = 1;
LeftMotor.startRotateFor(howMany, rotations);
RightMotor.rotateFor(howMany, rotations);

vex::task::sleep(1000);

howMany = -2;
LeftMotor.startRotateFor(howMany, rotations);
RightMotor.rotateFor(howMany, rotations);

on line 14 it keeps saying that it is incorrect

where is rotations defined ?

See the API for startRotateFor and rotateFor here
http://help.vexcodingstudio.com/#cpp/namespacevex/classvex_1_1motor/startRotateFor