Hi Sigtrygg,A sometimes inconvenient feature of the sonar sensor in ROBOTC is that it will report a value of -1 if it detects no obstacle. Try changing the condition of your first if statement in main to

You can select Robot>>Debugger Window>>Sensors to see the values the sensors are reading in real-time while your programming is running. You can then read through your program, plugging in these values and pretending you are the computer executing the code. This can help you figure out these types of problems.

Who is online

Users browsing this forum: No registered users and 2 guests

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