EV3 FLL Master Program

A Master Program allows you to combine all your missions in one program.  It is a big time saver and reduces stress.  The starting team just presses one button to move to the next program versus hunting and pecking through the menu structure.  A good master program allows you to navigate backwards and forward over runs.

Building a simple Master Program


A simple master program uses the wait block and my blocks.  For information on My Blocks, see the EV3 help.  Word of warning, kids love picking icons for their My Blocks.  They will spend hours if allowed.  It works by waiting for the middle button to be released before running the next program.  If you have a young or inexperienced team, I would recommend this master program.  It is simple to understand and program.

Building a Robot Nerd Master Program that displays the program and allows you move forward and back.


I know, what the hell is this.  It looks complicated.  If you team understands loops and switches, then it is actually simple.  The big concept is the variable block, which stores a value in memory. To teach the concept of memory and variable block, assign one team member to be the memory block.  You ask and give her a new number.  This worked for teaching this concept to my team.

The Robot Nerd Master Program displays the active program and allows you move forward and back over the programs.

Getting Started

  1. Create my blocks for each program you want to include in your master.  See the EV3 help for instructions on creating a my block.
  2. Create new program.

Variable Block

master1-countAdd a Variable Block as the first block. Set it to number and write.  Name it count and set the value to 1.  The variable tracks the active  program to run in memory.  You add or subtract 1 to move between programs.

Unlimited Loop

master2-loopAdd a loop and set the exit condition to “unlimited”.  The loop runs listening for actions inside.  The rest of the blocks will be inside the unlimited loop.

Displaying the Active Program

So the starting team can see the program that they are going to run, we want to display the active program.   We read the count value and pass it to a switch.  The switch reads the numbers and runs the block in the corresponding case statement.



  1. Add a variable block and set it read.
  2. Add a Switch that takes a number input.
  3. Connect the Count variable and switch block, the yellow wire.
  4. Add a case (the plus button) for each program you want to run. In this example 4.
  5. Number the switches, 1-4 in this example.  Set the first one to the default.
  6. Add a display block to each switch. I recommend adding numbers to the label.

If you were to run this now, it would display “1. Door”.  We set the variable to 1.


123 Lego – Running the first mission

The next step is triggering a program to run and then increment the Count variable by 1.


Running the Program

To achieve this, we add a switch block triggered by the brick button (Brick Button – Compare – Brick Buttons).  We set the switch brick button properties to the middle button and state to 2, indicating the middle button was pressed and released.

Like the display logic, read the Count variable and pass it into a switch.  Instead of the display, the associated My Blocks (the program) is in the case statement.

Automatically Moving Forward to the next program

Next we want to increment the count variable by 1 so will move to the next program.  There is a catch, we do not want to increment the count variable if it is set to the last program.   In this case, we don’t want to go from 4 to 5.  This requires some comparison logic.

  1. Read the Count Variable
  2. Compare the Count Variable to the number of your last run.  If the count variable does not equal the max value, 4 in this example.  The Compare block will pass a true or false.
  3. Pass the compare results (true or false) to the switch.  If the is true (Count does not equal 4), run the true case.
  4. In the true case, read the Count variable.
  5. Increment the Count Variable by 1
  6. Write the new Count Variable.


Moving Back a Program

Things happen and sometimes you want to go back a program.  You could exit out of the master, restart it or hunt and peck to find your program.  Here’s an idea, let’s add some logic that allows you to go back.  To do this, all you need to do is subtract 1 from the Count Variable when it is not equal 1.

In the code below, you press the left button.  If the Count Variable is not 1, is subtracts 1 and updates the Count Variable.



Moving Forward a Program

You are at a tournament and realize your runs are over 2.5 minutes and need to skip over a program.  Just like moving back, all we need to do is increment the Count variable by 1.  This logic already exist, we just need to trigger it with the right button.  You could make this logic a My Block.



Coast your motors

In a master program, if a run program ends when the motors ending with a stop, the motors lock.  You cannot roll the robot or adjust a motorized arm.  For example, the starting team can not roll the robot into position or position the arm.  This is simple to resolve, just set the last move or motor blocks to coast in your run My Blocks.  This unlocks the motors.

Beware of Master Program Ghost

shutterstock_203925415The program worked perfect when run as a standalone program but does strange things in the master.   I call this ghost.

I cannot explain why this happens but it is like the motor rotation sensors drift.  The issue is similar to the gyro drifting (which is more of a demon than a ghost).  We did figure out that adding a Motor Rotation Sensor and setting it to reset for each motor is our ghost buster.









6 thoughts on “EV3 FLL Master Program

  1. Jeff Schoolcraft

    We’ve experienced your ghost as well.

    We’re running NXTs and it seems whenever we run any program that has more than 1 MyBlock the MyBlock behavior is different than when run by itself.

    We’ve seen it mostly with motor rotation. We’ll try the Reset Motor trick. I hope it works because as of now we’re a two days away from competition and finding programs manually instead of using our Master Program.

  2. Moriah Lim

    Great idea! This program will definitely help our team reduce the amount of unnecessarily wasted time during competition and increase the time we have to accomplish more missions. Thanks so much for your suggestions and advice!

  3. Tim W


    The ASCS Minions have been experimenting with a Master Program or Menu Program.

    They have a few working, but cannot find one where you can stop the robot within a loop. They tried several things with Loop Interrupts, but nothing works so far.

    Do you know of a way to Interrupt a run without kicking out of the menu program. To stop a loop and go backto the menu?


    1. srakestraw Post author

      I would explore the Loop Interrupt Block. If you are in a master program and you need to recover the robot, you will need to stop the program and then start it again. If you need to navigate to another run, use a complex Master program. The post shows the complex master program. It is a loop with switch blocks triggered by brick buttons. I can provide more guidance if needed.

  4. DeDean HystadaDe

    Your “ghost” is caused by how the Move and Motor blocks work. It looks like motor moves are relative. You command the motor to move 90 degrees and it rotates 90 degrees. Command the motor to move 90 degrees again and it is now 180 degrees from the starting positon. Next you command the motor to move -180 degrees and it returns to the starting position. However, what really happens is the move and motor blocks adjust an internal ABSOLUTE command and the motor motion is controlled using this command.

    Using the previous example, the internal motor command starts out at zero when you start a program. You command the motor to move 90 degrees, changing the internal motor command to 90 degrees (0 + 90 = 90). A second 90 degree move command changes the internal command to 180 degrees (90 + 90 = 180). The final move command of -180 degrees changes the internal command to zero (180 – 180 = 0).

    But what happens if I move the motor by hand? I add a wait block between the first and second moves. During the wait I manually turn the motor back to zero degrees. Manually turning the robot does not change the internal command, so even though the motor is at zero degrees the internal motor command is still at 90 degrees. When I command the motor to turn 90 degrees it adjusts the internal motor command to 180 degrees, and the motor actually turns 180 degrees to get there (because it is starting at zero).

    The NXT motor reset command (not the rotation sensor reset) and the motor stop command for NXT and EV3 reset the internal command to equal the current motor position. This is why adding these commands at the very start of your mission “busts” these ghosts.

  5. Dean Hystad

    Your “ghost” is caused by the internal motor command not matching the current motor position when you execute a Move or Motor command. This can be caused by error in the previous move, or any manual manipulation of attachments or wheels. The next command “fixes” the mismatch, but the “fix” can be very confusing.

    Looking at the Move and Motor commands it appears that all motor control uses relative motion. Command a motor to rotate 90 degrees and it rotates 90 degrees. Command it to rotate 90 degrees again and it rotates 90 degrees (to a cumulative position of 180 degrees). Surprise! This is not what happens!

    The Move and Motor commands present a interface that lets you command the motors using relative commands, but the motor control is actually absolute. Each motor has an internal motor command that you cannot see. When a program starts all these motor commands are zero. When you command a motor to move 90 degrees it adds 90 degrees to this internal command and moves the motor. When you command 90 degree move the second time it add 90 more degrees so the internal command is 180 degrees.

    What happens if we put a wait block between the two 90 degree moves and spin the motor -180 degrees? Turning a motor by hand changes the motor position, but it doesn’t change the internal command. After the first move both the motor position and internal command are 90 degrees. After the manual move of -180 degrees the motor position is -90 degrees (90 – 180), but the internal command remains at 90 degrees. The second 90 degree move changes the internal command to 180 (90 + 90), but the motor position is -90 degrees. To get to the commanded position the motor has to turn 270 degrees. This is your ghost.

    To bust the ghost you need to reset the internal command. On NXT this was done using the RED motor reset block (not the rotation sensor reset block) or the Move or Motor STOP block. On EV3 this is don using the Move STOP block. This reset needs to be performed just before you begin executing the mission. To best reproduce stand-alone program conditions I would also reset all the rotation sensors and any timers used inside the mission. This will make running a mission my block inside your Master Program act exactly the same way it acts when running the block by itself.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>