View Single Post
  #2   Spotlight this post!  
Unread 07-04-2014, 14:13
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: How to loop peices of code forever?

In your code, you have

Code:
while(true)// i also tried while(1 == 1)
{
	motor[elbow] = -63;
	wait1Msec(1500);
}
so you're on the right track. Both while(true) and while(1 == 1) will work (because 1 == 1 evaluates to true so it's just a more indirect way of writing the same thing).

However, the block of code inside the while(true) loop is the only thing that will run forever. So at the moment, your elbow motor will run forever, but not the rest of the code.

You should change your code so that the while(true) { ... } surrounds the entirety of the code that you want to run forever.
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor