Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7007123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:34:00+00:00 2026-05-27T21:34:00+00:00

I am developing a robot for an engineering class. For the purposes of the

  • 0

I am developing a robot for an engineering class. For the purposes of the class I am required to use the NXT programming language. To move, the robot needs to follow a solid black line.

If the robot looses the line, I have it scan to the left for 1 second, or until it reaches a black line. If no line is found it scans to the right for 2 seconds so the initial position is reached then 1 more second or rotation is achieved.

I have the loop set up so that if the line has not been found, the robot continues to move. That runs for a full 1 second time period. If the line is found, motion stops, but the full second still has to complete. Ultimately that means that my program works perfectly, but is really really slow.

tl;dr Is there a way to make loops with two exit condition in the LEGO Mindstorm programming environment? Either after 1 second has elapsed, or a sensor gets the desired input?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:34:01+00:00Added an answer on May 27, 2026 at 9:34 pm

    Mindstorms does not have an OR function.

    The solution is to create an exit variable, then have two switch statements. In the example above, I had one switch statement with a timer, and the other with the sensor output. Set the exit variable to false, then inside a while loop, run until the exit variable is true.

    If the timer expires, set the variable to true, otherwise ignore the exit variable. Do the same with the sensor’s output.

    This is a messy and rather long solution, but it solves the problem perfectly within the rather limited LEGO Mindstorms system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a website in Drupal 6. I've 3 blocks (I use as footers),
I'm developing an app that (I believe) needs root privilege. There are plenty of
I'm new to developing apps in Android. We are currently creating a robot using
I am developing a multi-lingual site with Plone. I want to have one language
I'm developing a framework that, as one of its features, enables robots to use
I'm working on developing a WMI query for my application. It needs to find
In the root directory of a small site i'm developing i have the following
Developing websites are time-consuming. To improve productivity, I would code a prototype to show
Developing a .NET WinForms application: how can I check if the window is in
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.