© Fort Street High School Robotics
Go to the top menu, select Robot > Motors and Sensors Setup. Switch to the Sensors tab.
There are four sensors that correspond to ports 1 to 4 on your brick.
For S1 (Sensor 1), type in a name such as sensorLeft, and change the type to Light Sensor > Reflected Light (Active).
Connect a light sensor to port 1.
Click OK.
You should now see the following on your code:
#pragma config(Sensor, S1, sensorLeft, sensorLightActive)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
That means you’ve set it up correctly! If you ever need to change the sensor name, the third parameter (sensorLeft) can be edited right there, or by going back into Motors and Sensors Setup.
Top menu: Robot > Motors and Sensors Setup. Switch to Motors.
There are three motors for NXT and four motors for EV3 that correspond to ports A to C or A to D respectively.
For motorA (Motor A), type in a name such as motorLeft. You don’t need to change anything else. Reversed checkbox will reverse the motion, if your robot goes backwards.
Connect a motor to port A.
Click OK.
You should now see the following on your code:
#pragma config(Motor, motorA, motorLeft, tmotorNormal, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
That means you’ve set it up correctly! If you ever need to change the motor name, the third parameter (motorLeft) can be edited right there, or by going back into Motors and Sensors Setup.
You can also do the same for any other motors and sensors you plug in to your robot. Make sure you code so that the motor in the code corresponds to the correct motor connected to the brick!