View Single Post
  #4   Spotlight this post!  
Unread 15-02-2004, 13:44
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
Re: C Programming Question

just one more more question (maybe more depending on the answer...lol). im trying to write a practice autonomous code for the robot. my plan is to use the 'p1_sw_trig' button to enable a set of actions (in this case just to move the motor forward, then stop, then backward, then stop again using the counter function. im getting really weird syntax errors that i have no idea what's happening.

Code:
int counter = 0;
short end_program =  0;

void Process_Data_From_Local_IO(void)
{

if (end_program != 1)
	{
	counter++;

	if ((p1_sw_trig == 1) && (counter <= 120))
	{
	pwm01 = 127;
	}
	else if ((p1_sw_trig == 1) && (counter > 120))
	{
	pwm01 = 255;
	}
	else if ((p1_sw_trig == 1) && (counter > 240))
	{
	pwm01 = 127;
	}
	else if ((p1_sw_trig == 1) && (counter > 360))
	{
	pwm01 = 0;
	}
	else if ((p1_sw_trig == 1) && (counter > 480))
	{
	pwm01 = 127;
	end_program = 1;
	}
}


/********************************************************/
/********************************************************/
/********************************************************/
  <-------------------
the arrow points to the line that the syntax error was shown at. i put the code under the 'Process_Data_From_Local_IO' code because when i'd put it in the 'User_Autonomous_Code' it would give me an error at the 'Process_Data_From_Local_IO' line. let me know if im doing something wrong (obviously i am...lol). im pretty much a beginning programmer (HTML and TI-83...lol). any help you can give will help greatly.