View Single Post
  #7   Spotlight this post!  
Unread 24-03-2004, 12:30
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Biff
This C stuff is new to me, but the { }'s around line 367 I can't figure out if they all make sense, I think you may have some that are unmatched. Hope this helps
Oh, my. There's certainly something odd going on:
Code:
case DR_BOTH_CENTER:
{
    Navigator_State = AT_TARGET; // Both servos are within the target threshold
    printf("AT_TARGET\n");
    break;
}
}
}
    else
    {
        // We are not locked on - Stop
        // give the trackers a chance to catch up
        left_drive_set = LSTOP;
        right_drive_set = RSTOP;
        drive_timer++ ;
        if (drive_timer > LOST_TARGET_TIMEOUT) 
        {
            Navigator_State = TURN_TO_TARGET;
            printf("TURN_TO_TARGET\n"); // Done driving to center
            left_servo_set = 127;
            right_servo_set = 127;
        }
    }
    break;
}
There are three }s in a row right before a naked else statement. This source code is apparently missing a few lines, including an if.

There is also a case statement commented out near the top of the big switch. That can't be doing what you want, can it? If you want to "skip" that state, as the comments suggest, I think you need to initialize your state variable to DRIVE_TO_CENTER instead of WAIT_TO_DRIVE in line 37.