This example shows how to use a PID closed loop controller to set the velocity of a motor to a specified number of revolutions per minute. For demonstration, the velocity setpoint will be dependent on the joystick's y-axis value.
Set the variables at the beginning of the example to match your setup.
deviceID
- CAN device ID
Control the motor's velocity by moving the joystick up or down.
The setpoint and process variable will be displayed on SmartDashboard.