LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a block for one light sensor or one motor separately. Is it possible to give the number of the port as a parameter to a sensor or motor block via data wire? In NXT-G it was possible.

share|improve this question

Yes, it is possible to pass the port number as a parameter to a sensor or motor block via data wire. It's just that it's manually selected by default. To change this, go to the port of the sensor or motor block, and select the top-most option which has the plug icon on it:

port option

It will then create a data port for which motor port you want to use:

port data port

The same principle applies with sensor blocks. The input for both sensor and motor blocks is read as number, and you can validly enter a number 0-3 to represent which port.

port data port example

In the above example, a variable is created, and that variable is then passed to both the motor and sensor blocks. Since it was set as 1, it will move motor connected to port B, and wait until the touch sensor connected to port 2 has been touched.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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