FIRST Robotics Competition Blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Servo Control VI Snippet

Kelly_B
NI Employee (retired)

This example illustrates how to control a servo on your robot using an input - in this case, a potentiometer.  The potentiometer can be replaced with a joystick input, LabVIEW Front Panel input, or anything else that can be made to output a value between 0 and 1.

This VI Snippet uses a running average to output the mean of the last 5 potentiometer inputs to the servo. This helps to keep the servo's movement smooth.  Each new potentiometer value is stored in an array in the order it is read.  Once the array is full, the values are written over the existing values starting from the beginning.  The size of the array can be changed to include different quantities of values in the average.

Potentiometer Servo.png

Regards,
Kelly B.

National Instruments