Concept Explanation: Sensor Value [ sLabel]

Printer-friendly version


Motors and Sensors are very similar in robotC. They are both special variables that are used to interface with the attached devices. Where motors accept data inputs, sensors only output data. This sensor integer value represents a real world condition that the NXT is sensing. In order to act on that information, we have to interpret the data for the NXT. We will do that below in conditional statements. For now, let's look at the elements of the variable.


Just like motors, each sensor has a static and dynamic name. The dynamic name is the label you gave the sensor in "motor and sensor setup". The Static named is based of what port you have the device plugged into. In this case, we have the sensor in Port 3 so the static name is "S3". If the device was in port 1, the static name would be "S1".