Competition template and coding

i am new to programming this year know how to code some things .

i have a code set but the menu on the brain while using the program is confusing me here is my code

void usercontrol(void) {
  // User control code here, inside the loop
  while (1) {
    if(Controller1.Axis3.position(percent)>30) {
  Motor1.spin(forward);
  Motor3.spin(forward);
  Motor2.spin(reverse);
  Motor4.spin(reverse);
}
if(Controller1.Axis1.position(percent)>30){
  Motor1.spin(forward);
  Motor3.spin(reverse);
  Motor2.spin(forward);
  Motor4.spin(reverse);
}  

if(Controller1.ButtonR1.pressing()) {
  intake1.spin(forward);
  intake2.spin(forward);

if(Controller1.ButtonR2.pressing()) {
 intake1.spin(reverse);
 intake2.spin(reverse);
}

else{
  intake1.stop();
  intake2.stop();
}
}


    wait(20, msec); // Sleep the task for a short amount of time to
                    // prevent wasted resources.
  }
}

First off, welcome to the wonderful world of robot coding! I’m a bit confused as to what help you need. What about the menu on the brain is confusing you? Do you have a picture?

1 Like

Hi!

I put your code in a program to test it, and it all checks out. Could you be a little more specific with what you’re having trouble with?

(If you’re confused about the black screen while the program is running, that’s normal and there’s nothing to be worried about. That’s the output if you print something to the screen, and you aren’t, so it’ll be a blank black space.)

Quick indentation tip

Careful with your tabbing! Sometimes, when you don’t indent your code, you can easily confuse function layers with other function layers and it’s way harder to debug and understand.

If you right-click on the space next to the code, you’ll see a little menu box. Hit “Format Document” and it’ll indent everything perfectly for you. It’s a great tool and it makes things way easier to read.

Hope that helps, and feel free to ask more questions if it didn’t. :smiley:

2 Likes

For me, when I run the program, I don’t really worry about what’s on the screen. The only buttons I use are stop and run program. Besides that’s there’s nothing that I know of that will affect the program while running. You’re talking about the stuff that shows up on the V5 Brain when you run the program right?

On the Vex Controller, you can click the middle icon and then pick the Program you would like to run. Then select run. If you need anymore help just ask.

2 Likes