MXP I/O Expansion (FRC)

The “MXP I/O Expansion” example program demonstrates the use of the MXP I/O Expansion capabilities of the navX2-MXP / navX-MXP, including the following capabilities:


  • Pulse-Width Modulation [PWM] (e.g., Motor Control)
  • Digital Inputs (e.g., Contact Switch closure)
  • Digital Outputs (e.g., Relay control)
  • Quadrature Encoders (e.g., Wheel Encoder)


  • Analog Inputs (e.g., Ultrasonic Sensor)
  • Analog Input Trigger (e.g., Proximity Sensor trigger)
  • Analog Trigger Counter
  • Analog Output (e.g., Constant-current LED, Sound)

This example also demonstrates a simple method for calculating the ‘RoboRIO Channel Number’ which corresponds to a given navX2-MXP /navX-MXP IO Pin number.

FRC C++ Example

Full C++ source code on GitHub

FRC Java Example

Full Java Source code on GitHub

FRC LabView Example

The navX MXP IO LabView example shows how to make small modifications to the LabView “FRC RoboRIO Robot Project” using the “Mecanum Robot” configuration to access MXP Expansion IO Capabilities.


The invokes the during initialization, and routes the resulting DigitalIoObjects and AnalogIoObjects clusters to the

The instantiates the various objects which map onto the navX-MXP Expansion IO Pins.


The performs the translation from the navX2-MXP / navX-MXP Digital or Analog Pin number to the corresponding RoboRIO Channel Number, which is provided to the various VIs that open that particular port.


The reads the Joystick inputs and programs the output pins accordingly (PWM to motor controllers, Digital Outputs and Analog Outputs). As well, values from the input pins (Digital Inputs, Encoders and Analog Inputs) is retrieved and displayed on the Smart Dashboard.

Full LabVIEW Project on GitHub