View Single Post
  #4   Spotlight this post!  
Unread 18-02-2006, 09:39
Gamer930's Avatar
Gamer930 Gamer930 is offline
Team 930 and 171 Alumni
AKA: Justin
no team
Team Role: Alumni
 
Join Date: Mar 2002
Rookie Year: 2002
Location: New Berlin, WI
Posts: 388
Gamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to behold
Re: Need help with code

Code:
   angle = TILT_Servo;
	try_again = false;
		while (try_again == false)
		{
	first_angle = TILT_Servo;
	for (y = 1; y<=1000; y++)
	{
		  //do nothing-wait
	}
	second_angle = TILT_Servo;
	if (first_angle == second_angle)
	{
		   (TILT_Servo)
	}
	else
	{
			try_again = true;
	}


Couple of Things:
1. There is no Boolean Variables right out of the box for MPLAB. You can get them by assigning your variables as int and then have:
#define TRUE 1
#define FALSE 0
at the top of your code
2. Try and use indentation. It will make debugging your code a lot easier
3. I have noticed a lot that MPLAB doesn't like when you don't use {} on single line For/If/While statements. That is why I put those in.
4. == is for conditional statements. IF / While statements
= is for assignment statements. There were couple of places where those were messed up

If you have any more question feel free to contact me on one of my Instant Messaging ways
__________________
2010 to Present, Scorekeeper/Field Power Volunteer for FRC/FTC/FLL
2005 - 2010, Team 171 College Mentor
2002 - 2005, Team 930 Student