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