This code I'm trying to use for now just to get inline and close to the IR beacon on our FTC field however it only works and goes forward when it == 5 but when it is <5 or>5 the robot is completely stationary I am having a bit of trouble please help. The goal is to drive at first like parallel for a bit to get closer and then have the IR seeker direct the robot with the beacon, but I don't know what I should do to ignore the ir beacon because I want it to satisfy ==5 so it is lined up very closely and then to maybe use a touch or light sensor combination.

Wed Oct 24, 2012 12:09 pm

JohnWatson

Site Admin

Joined: Thu May 24, 2012 12:15 pmPosts: 722

Re: Ir Seeker Trouble

The problem with this one lies in the infinite loop; it does not have any opening or closing braces. In this case, ROBOTC will look at the line directly below the while loop as it's 'code' and will ONLY run that code inside of the loop. Since the first line under the while loop is the '== 5' line, the while loop will only be running that and the other two if statements are outside of the loop (and will never be reached because the while loop runs forever.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum