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.
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:
It will then create a data port for which motor port you want to use:
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.
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.