I have a code that lets me select an auton in vex coding studio in the pre auton loop. by incrementing a value everytime button left is pressing and displaying it on the controller. It is not changing anything on the vex controller screen nor rumbling the controller, nor changing the value. Somebody please help
Post your code so the community can better help you.
I’m a new user so I can’t upload it from the direct file but I do have a google docs version of it.
pre auton loop
It’s not a loop. That’s the problem.
How do I make it a loop? Just a while statement?
That is one method, yes. Make sure you include a break condition.
Ok Sorry, Im kinda new to Vex coding studio but can I break it by doing While variable PREAUTON is ==1 …do all this junk, if else (Preauton is == 0) go into auton loop
But then again, how do I break it into the auton loop , do I change preauton to a variable or is there something I am missing
For future reference, this is the best way to share code on this forum:
```
<your code here>
<on multiple lines>
<exactly as it appears>
<in your editor>
```
In other words, in the post editor:
- Go to a new line (press
Enter
) and type 3 backticks (`
, next to theEsc
and1
keys). - Then go to a new line again, and paste your code exactly as it was copied from VCS or whatever code editor you use.
- Then, at the end of your code, go to yet another new line and type the 3 backticks again.
Finally, if your code is long, select all of it and both lines of backticks, then press the (cog/gear) button and select
(
Hide Details
).
By using the competition template, the line Competition.autonomous( autonomous ); registers your function, autonomous, as the function to call when the competition control enters the autonomous state. You don’t have to do anything after that.
Im confused, so how do I use that to do pre auton, I have that in my code already
You just have to make sure that you leave pre auton. Don’t worry about how to get into auton.
Do I just stick with my code then, but insert the pre auton loop into the auton loop
Basically, Do I keep the original Statement but change Pre auton to a loop
You will not be able to receive joystick and button information in autonomous. You need to create a loop in preauton, or move the stuff to a loop in main that exits when auton or driver control starts.
while true(1)??? Because Im used to v4 Robot c
Replace the 1 with a condition that becomes false when you are done with or need to be done with picking autonomous.
This works the exact same as in ROBOTC.