In a few weeks I have a competition but can't get my program to work. I don't have a competition switch so I'm not using a competition template but the autonomous portion isn't working. It seems to be following the last remote command I give it. Here's a portion of the code:
While (1==1) { While (1==1) { If(vexRT[Btn5U]==1) //joystick code// } While (1==1) { If(vexRT [Btn6D]==0) { SensorValue[rightencoder]=0; Sensorvalue [leftencoder]=0; While (Sensorvalue [rightencoder]<103.5 { //motor on//
Sun Apr 03, 2016 6:58 pm
CARBOT
Expert
Joined: Thu Dec 01, 2011 12:07 am Posts: 151
Re: Autonomous not working
It looks like you need to practice nesting statements.
Code:
while (a>b) { //code }
if (c>d) { //more code }
To nest the if in the while:
Code:
while (a>b) { //code if (c>d) { //more code } }
Notice how the COMPLETE if statement is included in the while braces.
Consider posting your entire code in the code formatting tool.
Sun Apr 03, 2016 8:26 pm
faithjb
Rookie
Joined: Sun Apr 03, 2016 5:49 pm Posts: 3
Re: Autonomous not working
Without that format I loose the ability to use my joystick. I tried that way
Thu Apr 07, 2016 6:52 pm
CARBOT
Expert
Joined: Thu Dec 01, 2011 12:07 am Posts: 151
Re: Autonomous not working
Please post your whole code and explain what is does wrong.
Users browsing this forum: No registered users and 2 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum