I've seen teams, mostly in the world festival do this, and what they do is they program the robot so that when a brick button is pressed, the robot detects a value (usually RLI) and it is used later in the program. My program looks something like this so far.enter image description here

Am I on the right track? Is this program correct? Or am I completely wrong?

The program runs OK, but the variable can't be used later in the program.

  • 1
    Hi, the program runs but the variable can't be used later in the program. Thanks! Sep 18, 2017 at 22:17

2 Answers 2


First guess: the wait for button command is bad practice. Well, not the whole thing, just the use of the middle button. The reason is that that button is also used to start the program. The program may be jumping past the wait for and saving to "Midpoint" before humans notice that the program has started. Try any other brick button.


Your example doesn't read a RLI value. It reads and stores a color index value (0 through 8). This wouldn't stop you using the variable, but the value may not be what you expect.

Variables are global. You can read or write them anywhere in your program. The value of the variable is the last value written. Variables are not persistant. When your program ends the variable goes away. This means you cannot use variables to set a value and use it in a different program. To do something like that use a file,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.