If you happen to run into problems with getting your code to execute in the simulator, it could be because of one of the following reasons:
1. The simulator is not turned on, i.e. the Play button is not pressed.
2. There is a mismatch between the ports that are being specified in your code, and the ports that your simulated robot is using. To remedy this issue, follow these steps below:
Select the robot in the simulator
Open it’s Object Properties
(a) Expand the (NXT) or (EV3) label
(b) Observe the ports on the digital brick that are being used.
(c) Open the LEGO programming environment, and check that what is being specified in your move and sensor blocks match with the simulated robot’s object properties.
NXT configuration panel with matching ports for move block
Saving added attachments to the sample robot