Answers.Body: <p>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:</p>
  
  <p><img src="https://i.sstatic.net/0KaXB.png" alt="port option"></p>
  
  <p>It will then create a data port for which motor port you want to use:</p>
  
  <p><img src="https://i.sstatic.net/yBPMw.png" alt="port data port"></p>
  
  <p>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 1-4 to represent which port.</p>
  
  <p><img src="https://i.sstatic.net/QY6EA.png" alt="port data port example"></p>
  
  <p>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 A, and wait until the touch sensor connected to port 1 has been touched.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-15T17:28:35.600Z
Answers.Text: I just test with my EV3 with version 1.2.2 and V1.09H firmware I have connected motors to Port A B C, and number 1 to controlling motor at port A, not 0 so the result is 1-4 mapped to port A B C D Hope this helps.
Answers.UserDisplayName: dogwong
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-19T21:49:45.273Z
Answers.Text: Thank you so much for the correction @dogwong! I have edited my answer to correct this.
Answers.UserDisplayName: HaydenStudios
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-14T19:35:40.800Z
Answers.LastActivityDate: 2017-03-19T21:48:04.333Z
Answers.LastEditDate: 2017-03-19T21:48:04.333Z
Answers.UserDisplayName: HaydenStudios
Body: <p>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.</p>
  
Tags: <mindstorms><ev3><programming><ev3-g>
Title: Pass sensor or motor port number as a parameter
UserDisplayName: JanGe
ThreadText: # Pass sensor or motor port number as a parameter
  
  (Asked by: username_0 on 2014-07-14)
  
  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.
  
  **Tags:** mindstorms, ev3, programming, ev3-g
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-14. Score: 8
  
  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](https://i.sstatic.net/0KaXB.png)
  
  It will then create a data port for which motor port you want to use:
  
  ![port data port](https://i.sstatic.net/yBPMw.png)
  
  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 1-4 to represent which port.
  
  ![port data port example](https://i.sstatic.net/QY6EA.png)
  
  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 A, and wait until the touch sensor connected to port 1 has been touched.
  
  > **Comments:**
  > **username_2**: I just test with my EV3 with version 1.2.2 and V1.09H firmware I have connected motors to Port A B C, and number 1 to controlling motor at port A, not 0 so the result is 1-4 mapped to port A B C D Hope this helps.  
  > **username_1**: Thank you so much for the correction @dogwong! I have edited my answer to correct this.  
  
  ---
  
  