Digilent offers a Motor Adapter made just for myRIO. They also offer it part of the myRIO Mechatronics Accessory Kit. The motor adapter allows you to easily connect and control either one stepper motor, two DC motors, or two servos independently through the MXP connector on myRIO with no additional circuitry required. Additionally, the motor adapter offers over-current protection.
DC motors can be connected to the Digilent Motor Adapter using the two 6-pin connectors or using screw terminal connectors. The board conveniently connects the motor outputs and encoder inputs to the proper pins on the myRIO MXP connector so that you can use the following express VIs in the myRIO pallette for either MXPA or MXPB:
The PWM express VI can be used to control the motor speed (Use PWM0 and PWM 1 for Motor0 and Motor1, respectively)
The Encoder express VI can be used to read the motor position for Motor0 (for Motor1, encoder readings can be read from MXP digital inputs 19 and 21)
The Digital Output express VI to toggle the motor direction. MXP Pins 23 and 31 can be toggled to change the direction of Motor0 and Motor 1, respectively.
The Digilent Geared DC Motor is also part of the myRIO Mechatronics Accessory Kit. It is terminated with the 6-pin connector. Below and attached is example code for controlling speed and direction of the DC motor and reading encoder position and direction.