Autonomous help with vexcode

Hello Vex community,

My team is fairly new to the V5 system and c++ we were wondering if the community can help us get started with auton and and answer questions that we have. We use vexcode. (Very noob questions)

How do we make a motor move is it Motorname.spin(vex::directionType::fwd)

Do we use if else to stop a motor or do we just
Motorname.stop

These are all the questions we have now but maybe this can turn into a thread for teams who are just starting out or teams that are also confused.

Thanks in Advanced!!!

If you open up the VEXcode V5 Text editor you will be offered an array of programming examples and tutorials to help your team get started.
image

4 Likes

Oh thank you very much we will look into this right away!!!

I have built the code that we want to run on our V5 but it will not download to the Cortex or Compile so we can test it??? What could it be.

If you can share the code with us we will be glad to check it out

Check if your computer is connected to the V5 brain or controller. If it is, click on the top right button that looks like a download button should get the job done. If the button isn’t green though, it might be connection problem and it would not download.

If it will not compile then you have an error in your code. If you post your code, we can help you debug it.

If you update to the new version of vexcode that was just released this week I would highly recommend using the drivetrain command for newbies. Basically you can initialize your drivetrain with 2 or 4 motors and then it gives you a bunch of options for simple yet accurate driving. You will need to measure your wheelbase and track width, and the setup shows you where to measure for those.

Unfortunately the autofill for drivetrain commands seems to be down with the latest update, so here is a picture with all of the available commands.

drivefor and turnfor are going to be your best friends in autonomous.

Lastly, the first thing I do in my classes is to make sure that the turns are going the correct amount. If your robot is over or under turning (I usually just make them practice with a 90 deg. turn):

  1. Set your stopping mode to brake using the setStopping command
  2. Fiddle with your track width and wheel base until you get get it to turn true. From there it should be pretty easy to get your robot where you want it to go.

3 Likes

Here you image|547x500 u go, thanks.

Okay, so I am not as familiar with V5 Blocks (I mainly use V5 Text), but, I looked at the code from the image you sent and everything looked right. However, you may have more luck reposting this issue in its own thread and tagging it as VEXcode V5 Blocks Tech support because more people who are more familiar with blocks may see it there. However, if you decide to use VEXcode V5 Text, I can help you debug your code.

Could you send me a basic autonomous don in V5 text that I could look at as a reference? Just drive forward and back up will do.

Thanks,

This may seem nit-picky, but you are not going to download it to the Cortex. That is the old system. You want to download it to the V5 Brain. Trying to download VEXCode of any type to a Cortex will not work. Sorry to be snarky, but proper terminology often eliminates confusion.

You can get started with this tutorial:


I used the VEX Clawbot Competition Template in VEXcode V5 Text and programmed the driver control and a basic autonomous that makes the robot drive forward 4 inches and back up 4 inches. Let me know if you have any questions or need any help.
V5TextClawbotAuto.zip (102.3 KB)

3 Likes