Third-party sensors: Code examples

Here is a collection of code examples for third party sensors.

Codatex RFID sensorCodatex

Download Codatex code examples (ZIP) including:

  • RFID read NXT-G – This code will use the Codatex RFID sensor to find the correct RFID tag. Once the RFID sensor finds the correct tag, it will make a sound and the code will stop running.


Download HiTechnic code examples (ZIP) including:

  • Gyro sensor example (NXT-G) – This example uses the gyro sensor to change the pitch of the note being played as the gyro sensor is turned. It should be noticed that the gyro sensor can read in positive or in negative, so the sensor must be offset in order to be able to output a sound for all values of the sensor. This example is for the NXT-G software.
  • HiTechnic IRLink SensorIRLink – RCX make noise: NXT-G – This code uses the Hitechnic IR link sensor to make a nearby RCX make noise. The program is downloaded to an NXT with the IR link sensor. This sensor, when aimed towards the RCX, will send the data to the RCX, telling it to make a specific noise, which the RCX will immediately execute.
  • IRLink – RCX direct control: NXT-G – This code will allow the NXT to directly control the movement and function of a nearby RCX using the IR link sensor. This particular code will turn on the RCX’s motor for 3 seconds, then turn that motor off. Note: The code is to be downloaded to the NXT, not the RCX. Also, the IR link sensor must be nearby and/or pointed directly at the RCX to sucessfully transmit the data.
  • IRLink – Remote RCX control: ROBOLAB – This code will remotely control an RCX using an NXT and an IR Link sensor. The code to be run by the RCX is built into the program that the NXT will run. The NXT will send this program to the RCX and run it. Note: This code will be downloaded to the NXT, not the RCX.
  • IRLink – Read RCX sensor: ROBOLAB – This specific code uses the IR link sensor to read a particular RCX sensor using the NXT.
  • RCX make noise: ROBOLAB –  This code uses the NXT and IR link sensor to make the RCX make a specific noise. Note: The IR link sensor must be places near and/or aimed at the RCX in order to establish a good connection for the IR link sensor.
  • Direct RCX control example: ROBOLAB – This code will use the IR link sensor to directly control the function of a nearby RCX. This particular code will turn on two RCX motors for 1 second, then stop the motors. Note: The code is to be downloaded to the NXT, not the RCX.

Mindsensors Real Time ClockMindsensors

Download Mindsensors code (ZIP) including:

  • Real time clock example: NXT-G – This example will display the real time in the format (hour:minute:second  day/month/year), using the Mindsensors Real Time Clock Sensor.


Vernier Dual-Range Force SensorDownload Vernier Tensile Load Tester Programming – ROBOLAB (PDF):

  • Engineering design requires large sets of data and statistics to understand how materials will behave under a set of conditions. One of the material properties important to structural and mechanical engineers is the tensile strength of materials. The tensile strength corresponds to the force, or load, that a certain material can take along its axis before failing or yielding. For example if you were to pull on both ends of a string until it snapped, the amount of force needed to break the string would be the tensile failure force (known as normal stress). To measure the force, we will use a Vernier Dual-Range Force Sensor. This sensor can be accessed though ROBOLAB using Vernier’s Robobook. The Robobook can be found at  We will also employ an NXT motor, touch sensor and two gear boxes.




The following two tabs change content below.


The Tufts Center for Engineering Education and Outreach (CEEO) in Boston, Massachusetts, is dedicated to improving engineering education in the classroom, from Kindergarten to college. The Center houses faculty, staff, and graduate students from engineering disciplines and the education department.

Latest posts by CEEO (see all)