View unanswered posts | View active topics It is currently Sun Dec 10, 2017 10:01 pm






Reply to topic  [ 4 posts ] 
Autonomous not working 
Author Message
Rookie

Joined: Sun Apr 03, 2016 5:49 pm
Posts: 3
Post 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//


Sun Apr 03, 2016 6:58 pm
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Post 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
Profile
Rookie

Joined: Sun Apr 03, 2016 5:49 pm
Posts: 3
Post 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
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Post Re: Autonomous not working
Please post your whole code and explain what is does wrong.


Fri Apr 08, 2016 11:20 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.