Unlimited movement until reaching a wall Pro Preview

So far you have programmed the robot to move after the touch sensor was pressed.
Now we will make the robot start moving while the touch sensor is still pressed and then we’ll make the robot stop.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #622
  • 20 Aug 2017

Wait until another command is given

From now on the robot will often have to move until something happens. This something is usually a sensor which detects a specific condition.

First, we will show you the so called unlimited forward movement we want the robot to move forward for an unknown period of time - it could be from very short time to eternity. Nevertheless, we cannot set such numbers in the program which is why we will turn the motors on until another command is given:

Try out this program. The motors are turns on and the robot is waiting for another command in order to move to the next block. The next block is a 10 sec wait block. In these ten seconds the motors will be turning. Then the program ends which will make the motors gradually stop.

 

There is CATCH here: the block for unlimited movement cannot be the last block of the program. If it is the last block, the motors will turn on for a little while, the program will end and then the motors will stop.

 

In order to stop the motors, we need a block for turning the motors off:

 

This three-block construction (a block for unlimited movement, a block for waiting for something and a block for stop is very common and very important in the robotics classes.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Robotics with LEGO - Level 1.0 - Adventure in Space
  • 126
  • 123:52
  • 150
Image for Level A1. Introduction. Robotics with LEGO
  • 142
  • 133:42
  • 187
Image for Lesson 6 - Touch sensor
  • 10
  • 3
  • 6
  • 3d_rotation 0