ROBOTC.net forums
http://robotc.net/forums/

Autonomous not working
http://robotc.net/forums/viewtopic.php?f=11&t=13816
Page 1 of 1

Author:  faithjb [ Sun Apr 03, 2016 6:58 pm ]
Post subject:  Autonomous not working

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//

Author:  CARBOT [ Sun Apr 03, 2016 8:26 pm ]
Post subject:  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.

Author:  faithjb [ Thu Apr 07, 2016 6:52 pm ]
Post subject:  Re: Autonomous not working

Without that format I loose the ability to use my joystick. I tried that way

Author:  CARBOT [ Fri Apr 08, 2016 11:20 am ]
Post subject:  Re: Autonomous not working

Please post your whole code and explain what is does wrong.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/